1001Ferramentas
🔷Dev

tsconfig Base Generator

Generate a basic tsconfig.json for JS-to-TS migration.



  

A loose tsconfig for gradual migration

You have a large JavaScript codebase and want to start using TypeScript without freezing the team for a week. Turning strict on from day one usually produces four hundred errors and kills the momentum. What you need at that stage is a permissive tsconfig that accepts .js files next to .ts files and compiles without arguing.

The page has no fields: the block is already written and the Generate button simply reprints the same JSON. It sets target ES2020, module commonjs, allowJs true, strict false, esModuleInterop, skipLibCheck, outDir dist, an include for src and node_modules excluded. The easy thing to miss is allowJs without checkJs: your .js files get compiled, but nobody type-checks them.

Treat this as a starting point, not a destination. What tends to work is flipping one flag at a time, in the order noImplicitThis, strictNullChecks, noImplicitAny, clearing the errors from each step before moving on. To check a single JS file without touching the config, put // @ts-check at the top of it. On a greenfield project, go straight to the strict generator. It is all built in the browser.

Frequently asked questions

How is this different from the strict generator?
This one ships strict false, allowJs true, target ES2020 and module commonjs. The other turns strict on plus three extra checks and assumes a modern bundler.
Will my .js files be type-checked?
No. allowJs makes tsc compile them, but without checkJs their types are never verified. Add checkJs: true to the config, or // @ts-check per file.
When should I move off this config?
Once most of the code is .ts and the strictNullChecks errors fit into an afternoon of work. That is the moment to swap in the strict tsconfig.

Related Tools