-
Notifications
You must be signed in to change notification settings - Fork 13.3k
tsconfig.json inheritance needs an "off" switch? #16838
Description
It would be nice if there was a way to override/remove a setting in a tsconfig.json that "extends" a base configuration file. Here is an example:
tsconfig.base.json:
{
"compilerOptions": {
"outDir": "./Scripts/.tsbuild/",
"declaration": true,
"declarationDir": "./Scripts/types/"
}
}
tsconfig.json:
{
"extends": "tsconfig.base",
"compilerOptions": {
"outFile": "../../dashboard.js",
"declarationDir": null
}
}
We've setup tsconfig.base.json file for transpiling each TypeScript file into individual JavaScript files for modular objects, but we also need to be able to build single file libraries. If I can't turn off the "declarationDir" setting, I get build errors. Setting this to null appears to turn off the build errors, but I get a warning that this setting can only be a string. This is only an issue with conflicting settings.
However, I'm not entirely sure how the TypeScript team has envisioned this. Should we have multiple base configurations, some base configurations extending others, and then have the application (library) tsconfig.json extend from one of those? If not, then we need to be able to turn "off" a setting that was defined in a base configuration.