我是Typescript和Angular 2的新手。我需要安裝npm依賴項並將其用於我的角度2應用程序。無法找到typings.d.ts並在角度2打字稿應用程序中聲明模塊
的依賴是https://www.npmjs.com/package/ng2-stomp-service
我已經安裝了必要的軟件包,但我需要添加以下到我的typings.d.ts
文件
declare module 'stompjs';
declare module 'sockjs-client';
我無法找到typings.d.ts
文件在我的項目。
我曾嘗試以下,到目前爲止,
npm install typings --global
npm install @types/stompjs
npm isntall @types/sockjs-client
typings install dt~stompjs --save
typings install dt~sockjs-client --save
我typings.json
文件與內容,
{
"dependencies": {
"sockjs-client": "registry:dt/sockjs-client#1.0.3+20160727010356",
"stompjs": "registry:dt/stompjs#2.3.0+20161111105645"
}
}
當我跑我的角2的應用程序與npm start
它拋出的錯誤如下
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (27,2): Member 'config' implicitly has an 'any' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (36,2): Member 'queuePromises' implicitly has an 'any[]' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (83,32): Parameter 'str' implicitly has an 'any' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (132,53): Parameter 'response' implicitly has an 'any' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (27,2): Member 'config' implicitly has an 'any' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (36,2): Member 'queuePromises' implicitly has an 'any[]' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (83,32): Parameter 'str' implicitly has an 'any' type.
ERROR in D:/Userfiles/subramanians/projects/hand-cricket/node_modules/ng2-stomp-service/dist/stomp.service.ts (132,53): Parameter 'response' implicitly has an 'any' type.
我不確定是什麼原因造成的問題,我猜我t是因爲我還沒有申報模塊typings.d.ts
請指教。謝謝。