2016-08-12 17 views
3

私は活字体1.xのの角2エラーTS2304:名前を見つけることができません「RTCPeerConnection」

でのWebRTCを使用していますが、私は成功し、これを使用することができます。

const peerConnection = new RTCPeerConnection(configuration, null); 

しかし活字体2.xのに更新した後、私は私の端末でこのエラーを得た:

エラーTS2304: 'RTCPeerConnection' 名前を見つけることができません。

私はすでにnpm install --save-dev @types/webrtcでした。私のIDE WebStormはすでにRTCPeerConnectionのタイピングに正しくリンクしています。

{ 
    "compilerOptions": { 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "es5", 
    "module": "commonjs", 
    "removeComments": true, 
    "sourceMap": true, 
    "lib": ["es6", "dom"] 
    }, 
    "include": [ 
    "node_modules/@types/**/*.d.ts", 
    "src/**/*.ts" 
    ], 
    "exclude": [ 
    "node_modules", 
    "!node_modules/@types/**/*.d.ts" 
    ], 
    "compileOnSave": false, 
    "buildOnSave": false, 
    "atom": { 
    "rewriteTsconfig": false 
    } 
} 

私はそれをどのように操作を行うことができます。RTCPeerConnection

タイピング/my-project/node_modules/@types/webrtc/RTCPeerConnection.d.ts

マイtsconfig.jsonファイルであります正しく?

答えて

4

@types/webrtcはグローバルタイプの定義です。追加

"types": [ 
    "webrtc" 
] 

compilerOptionstypesオプションはhereと記載されています。

+0

ありがとう、完璧な作品! –

関連する問題