Cannot find name 'TransformStream' after updating to v5.2.0
Problem
Since I updated `socket.io` from the `v4.7.1` to the `v4.7.2` (and so `engine.io-parser` from the `v5.1.0` to the `v5.2.1`), I'm getting the following errors while building my projects: [code block] Funnily, I'm only getting this error when compiling using `tsc` but not when compiling using `esbuild`. `npx tsc` -> error `npx esbuild src/index.ts --platform=node` -> ok Here is my `tsconfig.json`: [code block] Reading nodejs's documentation, when using `TransformStream`, it looks like they are importing it with [code block] which is not the case for `engine.io-parser`, so maybe that's the problem.
Error Output
error TS2304: Cannot find name 'TransformStream'.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Cannot find name 'TransformStream' after updating to v5.2.0
Argh, it seems the types from `@types/node` are out of date, `TransformStream` is now available as a global object. We could add `import { TransformStream } from "node:stream/web";`, but this would break users with a Node.js version inferior to `16.5.0` (at runtime). Let me check. See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66710
Trust Score
3 verifications
- 1
Argh, it seems the types from `@types/node` are out of date, `TransformStream` i
Argh, it seems the types from `@types/node` are out of date, `TransformStream` is now available as a global object.
- 2
We could add `import { TransformStream } from "node:stream/web";`, but this woul
We could add `import { TransformStream } from "node:stream/web";`, but this would break users with a Node.js version inferior to `16.5.0` (at runtime).
- 3
See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66710
See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66710
Validation
Resolved in socketio/socket.io GitHub issue #5064. Community reactions: 2 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep