-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow overrides in tsconfig #33407
Copy link
Copy link
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Type
Fields
Give feedbackNo fields configured for issues without a type.
Search Terms
Suggestion
It would be nice if
tsconfig.jsonfiles would allow anoverridessection which works in the same way as ESLint. Here I have just one config file in my root for all kind of files and use cases. TypeScript currently needs multipletsconfig.jsonfiles.Use Cases
As far as I know editors like VS Code look for the nearest
tsconfig.jsonfor proper TypeScript support. This make it hard to properly type files which are used for different environments (e.g. source code vs tests vs storybook examples and so on) in the same directory, which seems to be a common convention nowadays (e.g.src/file.ts,src/file.test.ts,src/file.stories.ts).Most people seem to ignore this fact which makes test globals like
describeavailable in source code files.I once tweeted about this with a small example:
Examples
{ "compilerOptions": { "allowSyntheticDefaultImports": true, "module": "esnext", "moduleResolution": "node", "noEmit": true, "strict": true, "skipLibCheck": true, "target": "es2017", "types": [] }, "overrides": [ { "include": ["src/**/*"], "exclude": ["src/**/*.test.ts"], "compilerOptions": { "jsx": "react", "types": ["webpack-env"], "plugins": [ { "name": "typescript-styled-plugin" } ] } }, { "include": ["src/**/*.test.ts"], "compilerOptions": { "types": ["jest", "node"] } } ] }Checklist
My suggestion meets these guidelines: