我是TypeScript的新手,现在我在项目结构中的多个地方都有.ts文件:
app/
|-scripts/
|-app.ts
|
|-classes/
| |-classA.ts
| |-classB.ts
|
|-controllers/
| |-controllerA.ts
| |-controllerB.ts
|
|-otherStuff/
|-otherstuffA.ts
现在,当编译我的文件时,它们被编译到.ts文件所在的目录中:
app/
|-scripts/
|-app.ts
|-app.js
|
|-classes/
| |-classA.ts
| |-classB.ts
| |-classA.js
| |-classB.js
|
|-controllers/
| |-controllerA.ts
| |-controllerB.ts
| |-controllerA.js
| |-controllerB.js
|
|-otherStuff/
|-otherstuffA.ts
|-otherStuffA.js
虽然我喜欢.js文件与.ts文件保持相同的目录结构的方式,但我不想在我的VCS中跟踪.js文件,因此我想将所有JavaScript文件保存在单独的目录树(然后可以将其添加到.gitignore中),如下所示:
app/
|-scripts/
| |-app.ts
| |
| |-classes/
| | |-classA.ts
| | |-classB.ts
| |
| |-controllers/
| | |-controllerA.ts
| | |-controllerB.ts
| |
| |-otherStuff/
| |-otherstuffA.ts
|
|-js/
|-app.js
|
|-classes/
| |-classA.js
| |-classB.js
|
|-controllers/
| |-controllerA.js
| |-controllerB.js
|
|-otherStuff/
|-otherstuffA.js
是否有设置或选项可以告诉TypeScript编译器执行此操作?另外,我不确定是否相关,但是我正在使用WebStorm。