【发布时间】:2017-11-19 12:23:46
【问题描述】:
如果项目的大多数目录包含不超过 2-3 个 TypeScript 文件,并且在将包含目录导入其他地方时应该可以访问它们的所有导出,这会导致大量具有可预测内容的 index.ts 文件。
示例
目录:my-component
my-component-config.ts
my-component.ts
index.ts
index.ts 包含什么?当然,它包含
export * from "./my-component-config"
export * from "./my-component"
这很明显。
对于 10 个组件目录,这意味着:10 个 index.ts 文件包含 100% 冗余信息。
如何让 TypeScript(/Node) 隐式创建 index.ts 文件,无需存储在硬盘上?
【问题讨论】:
标签: javascript node.js typescript import directory