Specify alternate tsconfig.json for VS Code / ts-node / ts-node-dev
Asked Answered
M

1

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?

Metcalf answered 2/11, 2020 at 8:45 Comment(0)
M
6

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" }.
Metcalf answered 2/11, 2020 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.