From d632cce129cb7025a34cf0aa7262a38fb12f47c4 Mon Sep 17 00:00:00 2001 From: ud2 Date: Tue, 4 Jul 2023 02:36:55 +0800 Subject: fix(dts): make globals available on globalThis (#19438) This PR changes Web IDL interfaces to be declared with `var` instead of `class`, so that accessing them via `globalThis` does not raise type errors. Closes #13390. --- cli/tsc/dts/lib.deno.unstable.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cli/tsc/dts/lib.deno.unstable.d.ts') diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index 8f11adfff..bc770dab8 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -2268,10 +2268,19 @@ declare interface WebSocketCloseInfo { * @tags allow-net * @category Web Sockets */ -declare class WebSocketStream { - constructor(url: string, options?: WebSocketStreamOptions); +declare interface WebSocketStream { url: string; connection: Promise; closed: Promise; close(closeInfo?: WebSocketCloseInfo): void; } + +/** **UNSTABLE**: New API, yet to be vetted. + * + * @tags allow-net + * @category Web Sockets + */ +declare var WebSocketStream: { + readonly prototype: WebSocketStream; + new (url: string, options?: WebSocketStreamOptions): WebSocketStream; +}; -- cgit v1.2.3