sindresorhus/execa

error TS2304: Cannot find name 'TransformStream' 'ReadableStream' 'WritableStream'

qmonmert opened this issue · 8 comments

Since 9.0.1, when i do npm install:

node_modules/execa/types/stdio/type.d.ts:56:52 - error TS2304: Cannot find name 'TransformStream'.

56  | Unless<IsSync, DuplexTransform | WebTransform | TransformStream>;
                                                      ~~~~~~~~~~~~~~~

node_modules/execa/types/stdio/type.d.ts:78:63 - error TS2304: Cannot find name 'ReadableStream'.

78  | Unless<IsSync, (AsyncIterable<unknown> & ProcessStdinFd) | ReadableStream>;
                                                                 ~~~~~~~~~~~~~~

node_modules/execa/types/stdio/type.d.ts:88:19 - error TS2304: Cannot find name 'WritableStream'.

88  | Unless<IsSync, WritableStream>;
                     ~~~~~~~~~~~~~~

node_modules/execa/types/transform/normalize.d.ts:54:22 - error TS2304: Cannot find name 'TransformStream'.

54  readonly transform: TransformStream;
                        ~~~~~~~~~~~~~~~


Found 4 errors in 2 files.

Errors  Files
     3  node_modules/execa/types/stdio/type.d.ts:56
     1  node_modules/execa/types/transform/normalize.d.ts:54
```

An idea? Thanks a lot

Hi @qmonmert,

It appears you might have solved this problem.
Would you like to share how to solved it so that other users with the same problem can fix it too? Thanks!

@ehmicky no I don't fix it, I was not sure if it was a real problem, but if you have the same problem I reopen

Which --target and --lib TypeScript compiler options are you using?
Also, what is your version of @types/node?

@ehmicky "target": "ES2022" "lib": ["ES2022"] "@types/node": "20.11.25",

This is a bug from Execa.

We now support web streams, but we are importing their types from the DOM instead of from @types/node. Therefore, users would now need to do --lib es2022,dom, which they should not have to.

I opened a PR at #1043 to solve this.

We now support web streams, but we are importing their types from the DOM instead of from @types/node.

I would argue this is a @types/node bug. They are globals in Node.js and should be globals in the types too.

Yes, they are using the NodeJS interface for the web stream globals, for some reason. 🤔

@qmonmert This should now be fixed in 9.0.2

@ehmicky it works perfectly, thanks