Typescript errors with @types/webrtc

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

In my Angular 2 project, I'm trying to use typescript and @types/webrtc. @types/webrtc is at version 0.0.21 If I use any typescript version higher than 2.1.5, I get a lot of compilation errors for webrtc.

Here is my package.json file:

{
"name": "d3",
"version": "0.0.0",
"license": "MIT",
"scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
},
"private": true,
"dependencies": {
    "@angular/cli": "1.0.3",
    "@angular/common": "4.1.2",
    "@angular/animations": "4.1.2",
    "@angular/compiler": "4.1.2",
    "@angular/compiler-cli":"4.1.2",
    "@angular/core": "4.1.2",
    "@angular/forms": "4.1.2",
    "@angular/http": "4.1.2",
    "@angular/platform-browser": "4.1.2",
    "@angular/platform-browser-dynamic": "4.1.2",
    "@angular/router": "4.1.2",
    "@angular/material": "2.0.0-beta.5",
    "@types/hammerjs": "2.0.34",
    "hammerjs": "2.0.8",
    "angular2-material-datepicker": "0.5.0",
    "core-js": "2.4.1",
    "primeng": "4.0.1",
    "rxjs": "5.4.0",
    "ts-helpers": "1.1.2",
    "zone.js": "0.8.10"
},
"devDependencies": {
    "@types/jasmine": "2.5.47",
    "@types/node": "7.0.18",
    "@types/webrtc": "0.0.21",
    "angular2-template-loader": "0.6.2",
    "codelyzer": "3.0.1",
    "jasmine-core": "2.6.1",
    "jasmine-spec-reporter": "4.1.0",
    "karma": "1.7.0",
    "karma-chrome-launcher": "2.1.1",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.0",
    "karma-remap-istanbul": "0.6.0",
    "protractor": "5.1.2",
    "ts-node": "3.0.4",
    "tslint": "5.2.0",
    "typescript": "2.3.2",
    "webdriver-manager": "12.0.6"
}
}

Here are the compilation errors:

ERROR in objs/node_modules/@types/webrtc/RTCPeerConnection.d.ts (31,6): Duplicate identifier 'RTCSdpType'.

ERROR in objs/node_modules/@types/webrtc/
                                                
                                                
0 views
0 shares
profilepic.png
manpreet 2 years ago

Currently there is no official solution (or, at least, I have not found it). But there is a good workaround that it allows you to continue working!

As you can see in this issue in DefinitelyTyped Github web, Varius suggests add a marvelous option over compilerOptions in your tsconfig.json, to avoid library check.

"compilerOptions": {
    "skipLibCheck": true
    }

I hope it works for you as well it works for me!


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.