包含 TypeScript 编译器的 src 之外的文件夹

2023-12-27

我需要添加一个生成的文件夹,它既不是全局环境的一部分,也不在src,为源文件提供模块作为有效的命名空间,如下所示:

root
|- src
   |-- component
       |-- test.model.ts ( import { IBuilding } from 'api/interfaces.ts' );
|- generated
   |-- api
       | interfaces.ts ( export interface IBuilding {} )

我读过关于Modules and 模块分辨率在官方文档中,但以下选项均不适用:

  • tsconfig.json -> compilerOptions.paths(路径映射)
  • tsconfig.json -> compilerOptions.rootDirs(虚拟目录)
  • tsconfig.json -> include(文件名模式)

就我而言,它非常类似于CLASSPATH and PYTHON_PATH分别为 Java 和 Python 做。

有人可以帮忙吗?


似乎你可以在你的tsconfig.json with a filesGlob:

"filesGlob": [
    "**/*.ts", //Local source, this is the default
    "../generated/**/*.ts" //generated source
], //Add as many directories to the above list as needed
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

包含 TypeScript 编译器的 src 之外的文件夹 的相关文章

随机推荐