【发布时间】:2018-11-14 14:45:10
【问题描述】:
我想将枚举导入接口。 (使用打字稿2.5)但这会在另一个界面中使用该界面。这是示例代码
allEnums.ts
export enum ButtonType {
Top = 1,
Bottom = 2
}
other enums following ...
buttonInterface.d.ts
import { ButtonType } from "allEnums";
interface ButtonInterface {
buttonType: ButtonType
}
formInterface.d.ts
interface FormInterface {
buttos: ButtonInterface[]
}
结果是 formInterface.d.ts 中的错误
找不到名称按钮接口
像这样将 ButtonInterface 导入到 FormInterface 会有帮助
import { ButtonInterface } from "buttonInterface";
但我认为导入接口并不是一个好的解决方案
【问题讨论】:
标签: typescript enums interface