A command-line tool to migrate TypeScript configuration files to be compatible with TypeScript 6.0.
TypeScript 6.0 introduces several deprecations and breaking changes. This tool automatically migrates tsconfig.json files to account for two configuration breaking changes:
baseUrldeprecation: Before TypeScript 4.1,baseUrlwas required in order to usepaths. Many users only used it to enablepaths, but never removed it after it became unnecessary. This tool can safely removebaseUrland updatepathsmappings if necessary.rootDirdefault value change: TypeScript 6.0 changed howrootDiris inferred when unspecified. This tool can set explicitrootDirvalues to maintain TypeScript 5.x behavior.
# Choose which fix you need, or run each in series:
npx @andrewbranch/ts5to6 --fixBaseUrl .
npx @andrewbranch/ts5to6 --fixRootDir .
# Or to start with a config not named 'tsconfig.json':
npx @andrewbranch/ts5to6 --fixBaseUrl ./tsconfig.app.json
npx @andrewbranch/ts5to6 --fixRootDir ./tsconfig.app.jsonFrom the starting tsconfig.json file, the tool will recursively run on references, and also try to discover and update any related config files that will see a change through extends.