6

I'm migrating my project from JavaScript to Typescript.

I want to have the default tsconfig.json to show stricter warnings in VS Code, but have an alternate tsconfig.json with more lenient tsc compiler options to allow a successful build.

The migration plan is to gradually strict-ify the options in the alternate, just-compile-it-dammit tsconfig-dev.json file over time.

I can pass --project alt-tsconfig.json to tsc to specify an alternative tsconfig.json.

How can I specify which tsconfig.json to use with ts-node and ts-node-dev?

Tom Hale
  • 40,825
  • 36
  • 187
  • 242

1 Answers1

5

For both ts-node and ts-node-dev, you can pass:

-P tsconfig-dev.json

to specify an alternative path for tsconfig.json.

Alternatively, you can set the variable:

TS_NODE_PROJECT=tsconfig-dev.json

The latter also works for VS Code, which you may want do do via:

"env": { "TS_NODE_PROJECT": "tsconfig-dev.json" }.
Tom Hale
  • 40,825
  • 36
  • 187
  • 242