Jszip: Error TS2304: Cannot find name 'Blob'

Created on 14 Jul 2020  路  2Comments  路  Source: Stuk/jszip

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.

Most helpful comment

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

All 2 comments

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanakl picture ryanakl  路  4Comments

despairblue picture despairblue  路  7Comments

zizizi17 picture zizizi17  路  6Comments

bertbeck picture bertbeck  路  5Comments

v1nce picture v1nce  路  3Comments