2017-08-04 93 views
2

每當我跑我的角4的應用程序調用像這樣的一個枚舉...環境枚舉聲明錯誤

export declare enum RemoteStatus { 
    REMOTE = "REMOTE", 
    ACTIVATING = "ACTIVATING", 
    ACTIVE = "ACTIVE", 
    DEACTIVATING = "DEACTIVATING", 
    INACTIVE = "INACTIVE", 
} 
export declare enum Status { 
    UNKNOWN = "UNKNOWN", 
    LOCKED = "LOCKED", 
    UNLOCKED = "UNLOCKED", 
} 

它給我的NG出錯服務控制檯。

ERROR in D:/Projects/nem-swiftbc-app/node_modules/nem-library/dist/src/models/account/AccountInfo.d.ts (4,14): In ambient enum declarations member initializer must be constant expression. 

ERROR in D:/Projects/nem-swiftbc-app/node_modules/nem-library/dist/src/models/account/AccountInfo.d.ts (5,18): In ambient enum declarations member initializer must be constant expression. 

這可以防止加載應用程序。任何線索如何解決?

+1

你能刪除'declare'並重試嗎?並刪除最後一個逗號? – echonax

+0

@echonax嘗試刪除聲明,但它沒有奏效。仍然得到相同的錯誤。 –

+1

您正在使用哪個TS版本?你有沒有試過升級它? –

回答

0

我設法通過更新我的打字稿版本來解決這個問題。

npm install -g [email protected]