jszip icon indicating copy to clipboard operation
jszip copied to clipboard

Error TS2304: Cannot find name 'Blob'

Open kurdykartur opened this issue 5 years ago • 4 comments

The error started to occur after an update from 3.3.0 to 3.4.0 (and exist in 3.5.0 also) in our Typescript application. Adding the DOM to tsconfig.json fixes the problem but DOM is not needed in a backend application. We are using nodejs ver. 12.

kurdykartur avatar Jul 14 '20 06:07 kurdykartur

We tried downgrading but ultimately ended up with a custom type file.

  1. tell TypeScript where to find custom typings

in tsconfig.json:

{
  "compilerOptions": {
    "typeRoots": ["./node_modules/@types", "./types"]
  }
}
  1. declare type stub

in ./types/Blob/index.d.ts:

type Blob = never

cainlevy avatar Aug 24 '20 18:08 cainlevy

I'm also getting this error - I'm using JSZip in custom extension for vscode

node_modules/jszip/index.d.ts:33:11 - error TS2304: Cannot find name 'Blob'.

33     blob: Blob;
             ~~~~

node_modules/jszip/index.d.ts:45:11 - error TS2304: Cannot find name 'Blob'.

45     blob: Blob;
             ~~~~

Found 2 errors.

jszip 3.6.0

pkrukp avatar Feb 26 '21 13:02 pkrukp

We're facing the same issues on our end as well. We're currently using 3.10.1

pacholoamit avatar Aug 23 '22 18:08 pacholoamit

Hi @pacholoamit , this issue still exists in 3.10.1.

XinwenCheng avatar Oct 15 '22 06:10 XinwenCheng