fluency03
fluency03

Reputation: 2697

vscode - tsconfig.json's files cannot resolve file without extention

I have a tsconfig.json inside my project directory and the files is configured as following:

"files": ["src/index"],

I got error frmo VS Code saying:

File '/Volumes/Unix/Workplace/ProjectXXX/src/index' not found.

If I just change to this:

"files": ["src/index.tsx"],

Everything works.

I would like to know, is it necessary that I have to provide to explicit file extension for tsconfig.json?

Or is it a bug inside VS Code that it cannot auto recognize files with .ts, .tsx?

Upvotes: 1

Views: 633

Answers (1)

Robbie Milejczak
Robbie Milejczak

Reputation: 5770

The files property expects a list of files, and so they must have extensions. The files property will cause TSC to only analyze those files explicitly listed.

If you want to analyze an entire subdirectory it would probably be better to use the includes property.

The TypeScript documentation of tsconfig is worth a read

Upvotes: 1

Related Questions