Description
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: []
- Add the file to
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?