【发布时间】:2016-07-14 16:30:19
【问题描述】:
文件 AppActions.ts
export enum Actions {
START = 0,
RECOVER,
FIRST_RUN,
ALERT_NETWORK,
LOADING_DATA,
RECEIVED_DATA,
GO_OFFLINE,
GO_ONLINE
}
文件 PlayerActions.ts
import {Actions} from "./AppActions.ts"
enum Actions {
HEAL_SINGLE,
HIT_SINGLE
}
通常,关于this manual,它应该在编译时抛出错误。但是:
1- PlayerActions.ts 似乎没有扩展现有的 Actions 枚举。 (在 WebStorm 中 import {Actions} from "./AppActions.ts" 为灰色)
2- 编译器不会抛出任何错误。
那么在多个文件中声明 Enum 的正确方法是什么?
【问题讨论】:
-
您找到解决方案了吗?
标签: typescript enums