【发布时间】:2023-03-16 20:59:01
【问题描述】:
我正在使用 TypeScript API (3.8)。我注意到tsc 进行了一项检查,而 TS API 似乎没有这样做。
在构建程序时,如果设置了outDir和rootDir,如果在rootDir之外有模块的导入,tsc会报错,例如:
❯ yarn -s tsc --outDir dist
api/app.ts:3:8 - error TS6059: File '/Users/jasonkuhrt/hello/services/boo.ts' is not under 'rootDir' '/Users/jasonkuhrt/hello/api'. 'rootDir' is expected to contain all source files.
3 import '../services/boo'
~~~~~~~~~~~~~~~~~
Found 1 error.
但是,TS API 不会进行此项检查。
我不知道:
- 我做错了什么
- TS API 中存在错误
- TS API 中缺少一个功能
【问题讨论】:
标签: typescript typescript-compiler-api