我有一個npm模塊,我用於一些我的Typescript項目common-types
(回購:https://github.com/lifegadget/common-types)。最近添加的一個枚舉我有叫FirebaseEvent
火力地堡的工作項目,其定義爲:奇怪的TS導入問題
export enum FirebaseEvent {
value = 'value',
child_added = 'child_added',
child_moved = 'child_moved',
child_removed = 'child_removed',
child_changed = 'child_changed'
};
我遇到的問題是,當我嘗試導入枚舉以下表達式:
import { FirebaseEvent } from 'common-types';
我得到以下錯誤:
以供參考,常見類型文件的第5行是:
export interface IDictionary<T = any> {
[key: string]: T;
}
而且我強烈懷疑該錯誤消息是紅鯡魚,就好像我輸入以下任何它而不會出現錯誤:
import { IDictionary } from 'common-types';
import { IDictionary, datetime } from 'common-types';
然而,包括FirebaseEvent
任何進口 - 如下面 - 失敗,與上述相同的錯誤消息:
import { IDictionary, FirebaseEvent } from 'common-types';
我現在在我的空類上得到了語法錯誤:'export class __workaround__ {}' – ken