Angular 错误TS2304:找不到名称';RTPEERCONNECTION';
我在Angular 2中使用WebRTC 在TypeScript 1.x中,我可以成功地使用它Angular 错误TS2304:找不到名称';RTPEERCONNECTION';,angular,typescript,webrtc,typescript2.0,Angular,Typescript,Webrtc,Typescript2.0,我在Angular 2中使用WebRTC 在TypeScript 1.x中,我可以成功地使用它 const peerConnection = new RTCPeerConnection(configuration, null); 但在更新到TypeScript 2.x后,我在终端中遇到了以下错误: 错误TS2304:找不到名称“RTPeerConnection” 我已经完成了npm安装--save dev@types/webrtc,我的IDE WebStorm已经将它正确地链接到了rtpeer
const peerConnection = new RTCPeerConnection(configuration, null);
但在更新到TypeScript 2.x后,我在终端中遇到了以下错误:
错误TS2304:找不到名称“RTPeerConnection”
我已经完成了npm安装--save dev@types/webrtc,我的IDE WebStorm已经将它正确地链接到了rtpeerconnection
的类型
在/my project/node_modules/@types/webrtc/rtpeerconnection.d.ts中键入rtpeerconnection
我的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
}
}
如何正确执行此操作?
@types/webrtc
是一个全局类型定义。加
"types": [
"webrtc"
]
到您的编译器选项
。提到了类型
选项