我有在一个文件夹的一个项目,每一个模块应该有一个特定的接口:声明当前模块为具有特定接口
project/
modules/
A/index.ts
B/index.ts
C/index.ts
每个index.ts文件,应该坚持一定的界面。 事情是这样的:
export const foo = ...
export const bar = ...
我怎么能宣称每个index.ts文件必须导出某个接口? 换句话说,我需要告诉TypeScript,对于这些index.ts文件中的每一个,module.exports
都必须遵守某个接口。
我在Github上提交的问题,这与打字稿/ DefinitelyTyped:https://github.com/Microsoft/TypeScript/issues/19554
也许我应该使用模块或命名空间?一直避免,直到现在或许... –
*建立他们一个监狱!* – naomik
是的,但如何大声笑感谢:) –