Currently tsconfig.json is used both by tsc and typescript language service for IDE support.
The tsconfig.json need by tsc and typescript language service could be different:
- For
tsc, files: [] works just fine and actually have better control on what should be published
- For
typescript language service, exclude: [] works much better because when adding new file, you either need to:
- Add the file to
files: []
- Reference by another file that can be resolved from
files: []
Also, when package author write tests also in TypeScript, he may not want to have the tests be compiled and published along with source code.
I couldn't find a way to achieve this.
There are a few possible solutions:
a. add devExclude/devFiles in tsconfig.json. typescript language service will use this list if available.
b. Allow typescript language service to be configurable to use another config file, e.g. tsconfig.dev.json
c. Allow tsc to be configurable that by default use another config file, e.g. tsconfig.build.json
I'm aware that I can do tsc -p <directory>, but that wouldn't solve case where .ts and .spec.ts live in the same folder. Also, that's extra typing. The best case is to run tsc at project root and everything will just work.
Is there a .typescriptrc file available to add these options?
Currently
tsconfig.jsonis used both bytscandtypescript language servicefor IDE support.The
tsconfig.jsonneed bytscandtypescript language servicecould be different:tsc,files: []works just fine and actually have better control on what should be publishedtypescript language service,exclude: []works much better because when adding new file, you either need to:files: []files: []Also, when package author write tests also in TypeScript, he may not want to have the tests be compiled and published along with source code.
I couldn't find a way to achieve this.
There are a few possible solutions:
a. add
devExclude/devFilesintsconfig.json.typescript language servicewill use this list if available.b. Allow
typescript language serviceto be configurable to use another config file, e.g.tsconfig.dev.jsonc. Allow
tscto be configurable that by default use another config file, e.g.tsconfig.build.jsonI'm aware that I can do
tsc -p <directory>, but that wouldn't solve case where.tsand.spec.tslive in the same folder. Also, that's extra typing. The best case is to runtscat project root and everything will just work.Is there a
.typescriptrcfile available to add these options?