Skip to content

Errors when using types with a web worker. #114

@toji

Description

@toji

It seems like the types definition only works cleanly when used with the "dom" library. If you attempt to use it with the "webworker" library like so...

// Partial tsconfig.json
{
  "compilerOptions": {
    "lib": ["esnext", "webworker"],
    "typeRoots": [
      "./node_modules/@webgpu/types",
    ],
  }
}

Then you get the following errors:

node_modules/@webgpu/types/dist/index.d.ts:745:11 - error TS2304: Cannot find name 'HTMLVideoElement'.

745   source: HTMLVideoElement;
              ~~~~~~~~~~~~~~~~

node_modules/@webgpu/types/dist/index.d.ts:770:7 - error TS2304: Cannot find name 'HTMLVideoElement'.

770     | HTMLVideoElement
          ~~~~~~~~~~~~~~~~

These can be ignored by setting "skipLibCheck": true in the tsconfig, but ideally that should not be necessary to use the types in any valid environment.

I will note that it's not clear to me why HTMLVideoElement is the thing that it's latching onto here. HTMLCanvasElement would seem to have the same issue, as it's only exposed on window as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions