Configure from package.json
See original GitHub issueSearch Terms
package.json, config, configuration, tsconfig
Suggestion
Allow package.json
as an alternate source for tsconfig.json
options. To be clear, I am requesting that you please re-evaluate #6590 - it has been 2 years since that issue was posted, so interests may have changed and I believe this feature holds good value.
UPDATE: 2022-04-28
Please vote how you would like to see this feature implemented here: https://github.com/microsoft/TypeScript/issues/32830#issuecomment-1112372061
Use Cases
What do you want to use this for?
Provide a broader configuration support and decluttering the project root of configuration files that can easily be moved to package.json
.
What shortcomings exist with current approaches?
Some users prefer to store their all their configuration files in 1 larger file. Right now, that is not an option.
Examples
Example of what the package.json
would look like.
{
"name": "example",
"version": "1.0.0",
"description": "This is an example",
"license": "MIT",
"tsconfig": {
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"outDir": ".build",
"pretty": true,
"rootDir": "./",
"sourceMap": true,
"target": "ES5",
"strict": true
},
"exclude": [
"node_modules"
],
"include": [
"index.ts",
"src/**/*"
]
}
}
Checklist
My suggestion meets these guidelines:
- ✅ This wouldn’t be a breaking change in existing TypeScript/JavaScript code
- ✅ This wouldn’t change the runtime behavior of existing JavaScript code
- ✅ This could be implemented without emitting different JS based on the types of the expressions
- ✅ This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- ✅ This feature would agree with the rest of TypeScript’s Design Goals.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:178
- Comments:49 (13 by maintainers)
Top GitHub Comments
To get the consensus of those who are interested in this feature, please use the emojis on this comment to vote on which scenario you think the TS team should implement as the resolution to this feature request:
package.json
file, and anything more would be awesome but not required.@RyanCavanaugh Any update on this? It doesn’t seem too hard to implement, and it would be a great feature! Many of us are willing to contribute as well.