From 37d7a0aa791a4666ca405b11d0d8bdb199222e50 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Fri, 3 Feb 2023 11:58:36 +0100 Subject: [PATCH] fix(typings): do not expose browser-specific types Related: - https://github.com/socketio/socket.io-client/issues/1561 - https://github.com/socketio/engine.io-client/commit/b9252e207413a850db7e4f0f0ef7dd2ef0ed26da --- lib/transport.ts | 2 +- lib/transports/polling.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transport.ts b/lib/transport.ts index 30c49caa1..2894f96f2 100644 --- a/lib/transport.ts +++ b/lib/transport.ts @@ -21,7 +21,7 @@ class TransportError extends Error { export interface CloseDetails { description: string; - context?: CloseEvent | XMLHttpRequest; + context?: unknown; // context should be typed as CloseEvent | XMLHttpRequest, but these types are not available on non-browser platforms } interface TransportReservedEvents { diff --git a/lib/transports/polling.ts b/lib/transports/polling.ts index 512ecf960..bdd7e442b 100644 --- a/lib/transports/polling.ts +++ b/lib/transports/polling.ts @@ -292,7 +292,7 @@ export class Polling extends Transport { interface RequestReservedEvents { success: () => void; data: (data: RawData) => void; - error: (err: number | Error, context: XMLHttpRequest) => void; + error: (err: number | Error, context: unknown) => void; // context should be typed as XMLHttpRequest, but this type is not available on non-browser platforms } export class Request extends Emitter<{}, {}, RequestReservedEvents> {