Я использую WebRTC в Angular 2.
В TypeScript 1.x я могу успешно использовать это.
const peerConnection = new RTCPeerConnection(configuration, null);
Но после обновления до TypeScript 2.x я получил эту ошибку в своем терминале:
ошибка TS2304: не удается найти имя «RTCPeerConnection».
Я уже сделал npm install --save-dev @types/webrtc
, и моя IDE WebStorm уже правильно связывает его с вводом RTCPeerConnection
.
Ввод RTCPeerConnection
находится в /my-project/node_modules/@types/webrtc/RTCPeerConnection.d.ts
Мой файл tsconfig.json:
{
"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
}
}
Как я могу сделать это правильно?