sindresorhus / file-type

Detect the file type of a file, stream, or data
MIT License
3.72k stars 354 forks source link

Cannot find name 'ReadableStream' when compiling project with file-type dependency #643

Closed nickshater closed 4 months ago

nickshater commented 4 months ago

Getting this typescript compilation error after the recent changes to this code. Looked at the recently merged PR and saw some discussion around something like this. Is there a workaround or something I should be doing here, or am I doing something wrong?

error TS2552: Cannot find name 'ReadableStream'. Did you mean 'WebReadableStream'?

12 export type AnyWebReadableStream<G> = WebReadableStream<G> | ReadableStream<G>;
                                                                ~~~~~~~~~~~~~~

Found 1 error in node_modules/file-type/core.d.ts:12
Borewit commented 4 months ago

ReadableStream should be provided by the DOM API Typings.

In your tsconfig.json file, ensure that the "lib" property includes "dom".

Borewit commented 4 months ago

I assume the issue has been addressed, otherwise re-open the issue.