Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript): properly import the TransformStream type
When compiling with TypeScript with module set to "node16" and moduleResolution to "node16", the following error would be thrown: > node_modules/engine.io-parser/build/cjs/index.d.ts:6:54 - error TS2304: Cannot find name 'TransformStream'. > 6 export declare function createPacketEncoderStream(): TransformStream<Packet, any>; > ~~~~~~~~~~~~~~~ > node_modules/engine.io-parser/build/cjs/index.d.ts:7:96 - error TS2304: Cannot find name 'TransformStream'. > 7 export declare function createPacketDecoderStream(maxPayload: number, binaryType: BinaryType): TransformStream<Uint8Array, any>; > ~~~~~~~~~~~~~~~ > Found 2 errors in the same file, starting at: node_modules/engine.io-parser/build/cjs/index.d.ts:6 This is because the TransformStream object is not exposed in the global scope in the `@types/node` package, even though it is since Node.js `v18.0.0`. Reference: https://nodejs.org/api/webstreams.html#class-transformstream Note: we only import the TransformStream type (not value) because it isn't defined on older Node.js versions. Related: - https://github.com/socketio/engine.io-parser/issues/136 - socketio/socket.io-client#1606
- Loading branch information