vscode - tsconfig.json 的文件无法解析没有扩展名的文件

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

我的项目目录中有一个 tsconfig.jsonfiles 配置如下:

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

我在 VS Code 中收到错误消息:

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

如果我改成这样:

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

一切正常。

我想知道 tsconfig.json 是否必须提供明确的文件扩展名?

或者是 VS Code 中的一个错误,它无法自动识别带有 .ts.tsx 的文件?

文件 属性 需要一个文件列表,因此它们必须有扩展名。文件 属性 将导致 TSC 仅分析明确列出的那些文件。

如果要分析整个子目录,最好使用 includes 属性.

The TypeScript documentation of tsconfig is worth a read