Reputation: 49774
I am using WebRTC in Angular 2.
In TypeScript 1.x, I can use this successfully.
const peerConnection = new RTCPeerConnection(configuration, null);
But after updating to TypeScript 2.x, I got this error in my terminal:
error TS2304: Cannot find name 'RTCPeerConnection'.
I already did npm install --save-dev @types/webrtc
, and my IDE WebStorm already link it to the typing of RTCPeerConnection
correctly.
Typing of RTCPeerConnection
is in /my-project/node_modules/@types/webrtc/RTCPeerConnection.d.ts
My tsconfig.json file:
{
"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
}
}
How can I do it correctly?
Upvotes: 5
Views: 4339