Definitelytyped: @types/webrtc conflicts with typescript/lib/lib.es6.d.ts

Created on 14 May 2017  路  11Comments  路  Source: DefinitelyTyped/DefinitelyTyped

Adding dom inside compilerOptions does provides WebRTC types, but does not provides RTCDataChannel types throwing for example:

error TS2304: Cannot find name 'RTCDataChannel'.

and many more related to data channel types are missing.

Installing @types/webrtc does provide missing types, but the ones already provided withing dom lib produce duplicates, for example:

node_modules/typescript/lib/lib.dom.d.ts(15038,6): error TS2300: Duplicate identifier 'RTCSdpType'.

package.json

"devDependencies": {
    "@types/webrtc": "0.0.21"
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["es2017", "dom", "scripthost"]
}

If we remove dom then we get: Cannot find name 'DOMException'. and many others.

Most helpful comment

Works, but then my custom definitions are no longer checked. Wish there was a way to only disable for that one file.

All 11 comments

I'm also seing this issue

me too

Same issue here.

@vardius @mafrost @fpizzichillo did you find any solutions or workarounds for this problem?

Yes It works for me with "skipLibCheck": true

Here is full tsconfig.json that works for me

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "rootDir": "src",
    "outDir": ".code",
    "newLine": "LF",
    "lib": [
      "es2015",
      "es2016",
      "es2017",
      "dom",
      "scripthost"
    ],
    "moduleResolution": "node",
    "importHelpers": true,
    "declaration": true,
    "pretty": true,
    "sourceMap": true,
    "inlineSources": true,
    "noUnusedLocals": true,
    "skipLibCheck": true
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules",
    "**/*.spec.ts",
    "dist",
    "es",
    "lib"
  ]
}

Nice! Works for me

This worked for me as well. Thanks. @vardius!

works for me too. Thanks @vardius

Works, but then my custom definitions are no longer checked. Wish there was a way to only disable for that one file.

Awesome @vardius! Works wonderful! I think just like @NickClark! I would like disable only those libraries ing with problems

What's the proper way to solve this?

Was this page helpful?
0 / 5 - 0 ratings