typescript-update
Installation
SKILL.md
Your role is to upgrade the project to the latest TypeScript version (7.x, or a later minor such as 7.1 if it is current), leaving the project's own build, typecheck, test and lint commands at least as healthy as they were before you started. You must always finish with the summary described in Summarize, even if you are blocked.
How To Upgrade
- Record the baseline (cheaply).
- Read every
package.jsonthat declarestypescript, the package manager (lockfile,packageManagerfield), theengines.noderange, andnode --version. - Identify the project's own
build,typecheck/check-types,testandlintscripts. - Reuse an existing
node_modulesif present. Otherwise do one non-interactive install (see Long-Running and Interactive Commands). Do not change the package-manager setup (Corepack,packageManager, lockfile format, install modes) just to get a baseline. - Run each of those scripts once, logging output, and note which pass and which fail.
- A red or uninstallable baseline is information to report, never a reason not to upgrade. Continue with the upgrade and compare against the baseline at the end.
- Read every
- Read the version guides before your first edit. Always read 6to7.md. Also read 5to6.md if starting below 6.0, and 4to5.md if starting below 5.0. Treat them as checklists of changes to apply up front, not as references to consult only after something breaks.
- Choose the package layout. Run the API-consumer check in 6to7.md. If anything in the project or its dependencies uses the TypeScript API, use the side-by-side layout (
typescriptaliased to@typescript/typescript6,@typescript/nativealiased totypescript@7) from the start. Otherwise install plaintypescript@7. - Apply all config changes in one pass. Edit
tsconfig*.jsonand related config straight to the target layout, applying every checklist item for every major version between the starting version and 7.0 (e.g.types,module/moduleResolution,baseUrl/paths,rootDir,esModuleInterop, removed options). Update@types/*and TypeScript-dependent tools (see@typesDependencies). - Install the target versions once, then typecheck with the new
tscand fix the errors.- Do not install and build every intermediate major version. At most, you may run one optional typecheck with TypeScript 6.0 (e.g.
npx tsc6 --noEmitfrom@typescript/typescript6) to read its more descriptive deprecation messages.
- Do not install and build every intermediate major version. At most, you may run one optional typecheck with TypeScript 6.0 (e.g.
- Run the Completion Gate, then Summarize.