The file tsconfig.json
indicates that the project is using typescript. It specifies the different options required to compile the project.
There are situations when you are working on a huge project and migrating it from JavaScript to TypeScript. While new code is well-typed the older code is in a state where type-checking can not be as strict.
The need arises for different levels of type strictness in different sub-folders of the same project. This can be achieved using multiple config files.
Example: You do not allow the type any
in your new subfolder. But the rest of your project being much legacy, still uses any
here and there.
You can have "noImplicitAny": false
in your main config file.
Inside the new subfolder, you can have another tsconfig.json
file, which extends the main tsconfig.
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"noImplicitAny": true
},
"include": ["*"]
}
This is a game changer for huge projects and allows for agile development.
Top comments (0)