我想知道在typescript中组织接口定义的推荐方法是什么.在我的项目中,我有很多不同的课程.每个类都可以有一个配置界面.目前,我已将所有这些接口定义收集到一个文件中,Interfaces.ts并从不同位置引用该文件.
有没有更好的办法?
示例:https://github.com/blendsdk/blendjs/blob/devel/blend/src/common/Interfaces.ts
bas*_*rat 43
有没有更好的办法
打字稿团队使用一个名为types.ts:https://github.com/Microsoft/TypeScript/blob/master/src/compiler/types.ts
我做同样的在我的项目如http://alm.tools:https://github.com/alm-tools/alm/blob/master/src/common/types.ts
小智 13
我喜欢这样构建我的应用程序:
|-- app
|-- components
|-- directives
|-- services
|-- interfaces
|-- <feature/component name>
|-- <interface name>.interface.ts
Run Code Online (Sandbox Code Playgroud)
pou*_*uya 11
我的项目是这样构建的
src/
??? ts
??? enums
? ??? app_enums.ts
? ??? db_enums.ts
??? interfaces
? ??? app_interfaces.ts
? ??? db_interfaces.ts
? ??? global_interfaces.ts
??? types
??? app_types.ts
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14991 次 |
| 最近记录: |