How can I use an inner config.json
in my Typescript project?
For clarity:
I have a root /config.json
as following:
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"inlineSourceMap": true,
"outDir": "./app/",
"lib": [
"es6"
],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "node",
"baseUrl": "./",
"noImplicitAny": true,
"skipLibCheck": true,
"paths": {
"*": [
"types/*"
]
}
},
"include": [
"./src/**/*.ts"
]
}
I want to have a /innerFolder/config.json
with the following:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noImplicitReturns": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"strictNullChecks": true,
}
}
I'm doing that because I want to make a refactor on the team's code, but it's big and I don't want to change the all my files at once.
I want to do it folder-by-folder and "lock" the folder with the changes.
According to the documentation, the compiler looks up to a parent tsconfig.json
, but not down for specific tsconfig.json
.
Is there a way to accomplish that?
TypeScript 2.1 added configuration inheritance and this should now work the way you're using it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With