I'm trying to work on this TypeScript project. I've written a tsconfig.json, and when I try running from the command line, everything works fine.
However, when I try editing the project's files in Visual Studio Code, Visual Studio, Sublime, or WebStorm, those settings don't appear to be getting applied. Here's a few things that are special about this tsconfig.json in case it helps:
- It uses the strictflag.
- It uses noImplicitAnyandstrictNullChecksfor good measure.
- It uses path mapping (i.e. the pathsandbaseUrlfields).
How can I get this working?
 
                        
First: make sure your
tsconfig.jsonis free of syntax errorsYou might add a field to your configuration file, but JSON is a very picky language, so while you may have previously run with
tsc, you might not have noticed yourtsconfig.jsonwas recently broken.Second: make sure that your files are being included in the project configuration
First, check that your
tsconfig.jsonis including your files by runningtscusing the--listFilesflag.If the files are not listed by
tsc --listFiles, you can add them to yourtsconfig.jsonusing a set of top-level fields:The
include&excludefieldsThe easiest way is to specify a series of patterns (specifically "globs") to match folders & files using the
"include"and"exclude"fields. This can be an entire folder like./src.For example:
The
filesfieldYou can specify the list of files using the
"files"field. If you have a single file that transitively imports everything else, then you can just list that entry-point. But make sure you end up actually importing those files.For example: