Jakub Licznerski
Jakub Licznerski

Reputation: 1088

TS2304: Cannot find name 'RTCErrorEvent'

I'm implementing a WebRTC app using Quasar, typescript and Vue. This piece of code does not yield any error in WebStorm (uses project's eslint config), I can go to RTCErrorEvent definition in DOM API file (lib.dom.d.ts):

  handleDataChannelError(error: RTCErrorEvent) {
    console.log('dataChannel.OnError:', error);
  }

However when I run the application via quasar dev or try to build it with quasar build I get an error TS2304: Cannot find name 'RTCErrorEvent'. Running esling via lint task eslint --ext .js,.ts,.vue ./ yields no errors as well.

I've already tried this with installing @types/webrtc and this (adding to quasar.d.ts), with no effect. I've checked and node_modules/@types/webrtc does not contain this class.

My tsconfig.json:

  "extends": "@quasar/app/tsconfig-preset",
  "compilerOptions": {
    "target": "es2020",
    "lib": [
      "es2020",
      "dom"
    ],
    "baseUrl": "."
  }
}

In Quasar CLI docs in can find only this bit which explains how the dev server works...

While developing with Dev Server ($ quasar dev):

  • Babel, so you can write ES6 code
  • Webpack + vue-loader for Vue SFC (single file components)
  • State preserving hot-reload
  • State preserving compilation error overlay
  • Lint-on-save with ESLint
  • Source maps
  • Develop right on a device emulator (or a real phone connected to your machine) if you target a Mobile App
  • ...

Is there something obvious that I'm missing? Should I dug deeper into quasar.conf.js or babel.config.js? Also, interestingly I cannot locate lib.dom.d.ts file in project files. How can I check which version/file of DOM API is used by Quasar dev server?

Upvotes: 0

Views: 475

Answers (1)

changwoo lee
changwoo lee

Reputation: 1

Have you tried adding webrtc to the compilerOptions.types property of tsconfig.json ?

Upvotes: 0

Related Questions