Skip to content

error TS2304: Cannot find name 'DedicatedWorkerGlobalScope' #108

@laurentpellegrino

Description

@laurentpellegrino

Using version 7.0.4 with this tsconfig:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": true,
    "esModuleInterop": true,
    "module": "commonjs",
    "noImplicitAny": false,
    "outDir": "dist/",
    "rootDir": "src",
    "strict": true,
    "target": "es2018",
  }
}

I am getting:

tsc --emitDeclarationOnly

node_modules/penpal/dist/penpal.d.ts:193:22 - error TS2304: Cannot find name 'DedicatedWorkerGlobalScope'.

193 worker: Worker | DedicatedWorkerGlobalScope;

Adding to my tsconfig the following under compilerOptions:

    "lib": ["es2018", "dom", "webworker"]

the DedicatedWorkerGlobalScope definition is found but then I get a lot type errors with TypeScript libs:

https://gist.githubusercontent.com/lpellegr/2d0da961f63317441a77c3eb1589a28a/raw/f12dfcb326a743d597d68bdf05313ed640a6eb2a/gistfile1.txt

Checking the Penpal tsconfig file, I see "skipLibCheck": true, is used. Is that voluntary?

Another solution seems to create a global.d.ts and put a dummy definition:

interface DedicatedWorkerGlobalScope extends Worker {}

However, is there no better solution than making such a definition or skipping lib types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions