luma.gl icon indicating copy to clipboard operation
luma.gl copied to clipboard

TS2304 without skipLibCheck: true

Open mircowidmer opened this issue 2 years ago • 4 comments

I am using the following dependencies in my angular application:

  • @deck.gl/core: 8.8.4
  • @deck.gl/geo-layers: 8.8.4
  • @deck.gl/layers: 8.8.4

Since upgrading to Angular 14 I am getting the error described below. When I disable the type checking in my tsconfig.json file with the following line:

"skipLibCheck": true,

I am not getting the error. When I dig deeper into the package-lock.json, I see that the package @deckgl/core is using @luma.gl/core:

    "@deck.gl/core": {
      "version": "8.8.4",
      "resolved": "https://registry.npmjs.org/@deck.gl/core/-/core-8.8.4.tgz",
      "integrity": "sha512-/EYtLZ7cQpTDHPAlThcIt9BjlPfVFMWaRmsT50ovFpecagBm9Uh5RAo1TsVqSDAad/y0CvZq1FNI/H+JidDPMQ==",
      "requires": {
        "@loaders.gl/core": "^3.2.5",
        "@loaders.gl/images": "^3.2.5",
        "@luma.gl/constants": "^8.5.16",
        "@luma.gl/core": "^8.5.16",
        "@math.gl/core": "^3.6.2",
        "@math.gl/sun": "^3.6.2",
        "@math.gl/web-mercator": "^3.6.2",
        "@probe.gl/env": "^3.5.0",
        "@probe.gl/log": "^3.5.0",
        "@probe.gl/stats": "^3.5.0",
        "gl-matrix": "^3.0.0",
        "math.gl": "^3.6.2",
        "mjolnir.js": "^2.7.0"
      }
    },

Actual Result

Error: node_modules/@luma.gl/gltools/src/context/context.d.ts:17:41 - error TS2304: Cannot find name 'OffscreenCanvas'.

17   canvas?: HTMLCanvasElement | string | OffscreenCanvas | null; // A canvas element or a canvas string id

Expected Result

No error TS2304 and no need to skip lib checks.

Reproduce Steps

Create a sample Angular application, use the three dependencies and try to compile the application.

mircowidmer avatar Jul 19 '22 14:07 mircowidmer

This was addressed by https://github.com/visgl/luma.gl/pull/1649. It is included in @luma.gl/* 8.5.14 and above. Can you check your installed version?

Pessimistress avatar Jul 19 '22 15:07 Pessimistress

This was addressed by #1649. It is included in @luma.gl/* 8.5.14 and above. Can you check your installed version?

Based on my package-lock.json version 8.5.16 is installed:

    "node_modules/@luma.gl/core": {
      "version": "8.5.16",
      "resolved": "https://registry.npmjs.org/@luma.gl/core/-/core-8.5.16.tgz",
      "integrity": "sha512-w3goHMFEhQFlpoXXygFD6zaZvu4rYvMLfDXThpBMUYm8Y4k46UREFYhsV1aOe1aJlaolsRT/9J2fgSDXr0yA3w==",
      "dependencies": {
        "@babel/runtime": "^7.0.0",
        "@luma.gl/constants": "8.5.16",
        "@luma.gl/engine": "8.5.16",
        "@luma.gl/gltools": "8.5.16",
        "@luma.gl/shadertools": "8.5.16",
        "@luma.gl/webgl": "8.5.16"
      }
    },

package-lock.json.txt

mircowidmer avatar Jul 20 '22 06:07 mircowidmer

I am not an Angular user, though I cannot reproduce this in a React app. @types/offscreencanvas is supposed to supply the OffscreenCanvas definition.

Pessimistress avatar Jul 20 '22 07:07 Pessimistress

I'm also using Angular and I had to add "offscreencanvas" to the compilerOptions.types array in tsconfig.app.json.

ctusch avatar Sep 20 '22 09:09 ctusch

Closing as it sounds like this has been resolved, but please let us know if that's not correct!

donmccurdy avatar Dec 06 '23 14:12 donmccurdy