Skip to content

Commit 8f60370

Browse files
authored
🤖 Merge PR DefinitelyTyped#73578 fix(node/http): properly re-export WebSocket, MessageEvent, CloseEvent types by @auvred
1 parent 0ce90e6 commit 8f60370

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

‎types/node/http.d.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,15 +2031,15 @@ declare module "http" {
20312031
* A browser-compatible implementation of [WebSocket](https://nodejs.org/docs/latest/api/http.html#websocket).
20322032
* @since v22.5.0
20332033
*/
2034-
const WebSocket: import("undici-types").WebSocket;
2034+
const WebSocket: typeof import("undici-types").WebSocket;
20352035
/**
20362036
* @since v22.5.0
20372037
*/
2038-
const CloseEvent: import("undici-types").CloseEvent;
2038+
const CloseEvent: typeof import("undici-types").CloseEvent;
20392039
/**
20402040
* @since v22.5.0
20412041
*/
2042-
const MessageEvent: import("undici-types").MessageEvent;
2042+
const MessageEvent: typeof import("undici-types").MessageEvent;
20432043
}
20442044
declare module "node:http" {
20452045
export * from "http";

‎types/node/test/http.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,3 +730,9 @@ import * as url from "node:url";
730730

731731
http.setMaxIdleHTTPParsers(1337);
732732
}
733+
734+
{
735+
new http.WebSocket("ws://example.com", ["protocol"]);
736+
new http.CloseEvent("close");
737+
new http.MessageEvent("message", { data: "data" });
738+
}

‎types/node/v22/http.d.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,15 +2031,15 @@ declare module "http" {
20312031
* A browser-compatible implementation of `WebSocket`.
20322032
* @since v22.5.0
20332033
*/
2034-
const WebSocket: import("undici-types").WebSocket;
2034+
const WebSocket: typeof import("undici-types").WebSocket;
20352035
/**
20362036
* @since v22.5.0
20372037
*/
2038-
const CloseEvent: import("undici-types").CloseEvent;
2038+
const CloseEvent: typeof import("undici-types").CloseEvent;
20392039
/**
20402040
* @since v22.5.0
20412041
*/
2042-
const MessageEvent: import("undici-types").MessageEvent;
2042+
const MessageEvent: typeof import("undici-types").MessageEvent;
20432043
}
20442044
declare module "node:http" {
20452045
export * from "http";

‎types/node/v22/test/http.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,3 +730,9 @@ import * as url from "node:url";
730730

731731
http.setMaxIdleHTTPParsers(1337);
732732
}
733+
734+
{
735+
new http.WebSocket("ws://example.com", ["protocol"]);
736+
new http.CloseEvent("close");
737+
new http.MessageEvent("message", { data: "data" });
738+
}

0 commit comments

Comments
 (0)