2016-08-12 3 views
3

내가 사용의 WebRTC를 찾을 수 없습니다.오류 TS2304 : 나는 성공적으로 사용할 수 <strong>타이프 라이터 1.x에서</strong>에서</p> <p>각도 2의 이름 'RTCPeerConnection'

오류 TS2304 : 이름 'RTCPeerConnection'을 찾을 수 없습니다

const peerConnection = new RTCPeerConnection(configuration, null); 

그러나 타이프 라이터 2.x를로 업데이트 한 후, 내 터미널에서이 오류가 발생했습니다

.

는 이미 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 
    } 
} 

내가 어떻게 할 수있는 바르게?

답변

4

@types/webrtc은 전역 유형 정의입니다. 추가

"types": [ 
    "webrtc" 
] 

compilerOptions에 추가하십시오. types 옵션은 here입니다.

+0

감사합니다. 완벽하게 작동합니다. –