From 039b45cc65b50acc1f9da42ad605eaccb8ccbcde Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sat, 30 Apr 2022 12:36:57 +0200 Subject: [PATCH] fix(typings): update the type of RawData We could also split the declaration of RawData with the "browser" field: ``` // for Node.js export type RawData = string | Buffer | ArrayBuffer | ArrayBufferView; // no Blob // for the browser export type RawData = string | ArrayBuffer | ArrayBufferView | Blob; // no Buffer ``` But it does not seem supported by the TypeScript compiler, so we'll revert to just using "any" for now. Related: https://github.com/socketio/engine.io-parser/issues/128 --- lib/commons.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/commons.ts b/lib/commons.ts index aaf5fba8..9156e367 100644 --- a/lib/commons.ts +++ b/lib/commons.ts @@ -26,7 +26,9 @@ export type PacketType = | "noop" | "error"; -export type RawData = string | Buffer | ArrayBuffer | ArrayBufferView | Blob; +// RawData should be "string | Buffer | ArrayBuffer | ArrayBufferView | Blob", but Blob does not exist in Node.js and +// requires to add the dom lib in tsconfig.json +export type RawData = any; export interface Packet { type: PacketType;