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?
Once I only needed the rules for strict checking, I was able to achieve it using tslint
.
extends
from tslint
does exactly what I need, it goes down, overriding rules in inner directories.