3
我使用的WebRTC在打字稿1.x中,我可以成功地使用这个。错误TS2304:不能在角2</p> <p>找到名为“RTCPeerConnection”
const peerConnection = new RTCPeerConnection(configuration, null);
但更新到打字稿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
}
}
我怎样才能做到这一点是否正确?
谢谢,作品完美! –