aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-07-14 19:49:15 -0700
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-07-14 19:49:15 -0700
commite546e4064c5f22e60559f1fd544928fe3ffe260f (patch)
treeb027bab47855fd817ee5cb992968d22927a56b22
parentc39c11e1011b682c2c4e48594c7d6110cfc3343c (diff)
downloadbun-e546e4064c5f22e60559f1fd544928fe3ffe260f.tar.gz
bun-e546e4064c5f22e60559f1fd544928fe3ffe260f.tar.zst
bun-e546e4064c5f22e60559f1fd544928fe3ffe260f.zip
`structuredClone` types
-rw-r--r--packages/bun-types/globals.d.ts23
1 files changed, 15 insertions, 8 deletions
diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts
index cb9f3d1bc..62bc37a82 100644
--- a/packages/bun-types/globals.d.ts
+++ b/packages/bun-types/globals.d.ts
@@ -356,6 +356,16 @@ interface StructuredSerializeOptions {
transfer?: Transferable[];
}
+/**
+ * Creates a deep clone of an object.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone)
+ */
+declare function structuredClone<T>(
+ value: T,
+ options?: StructuredSerializeOptions,
+): T;
+
interface EncodeIntoResult {
/**
* The read Unicode code units of input.
@@ -1930,7 +1940,7 @@ type WebSocketEventMap = {
ping: MessageEvent<Buffer>;
pong: MessageEvent<Buffer>;
error: Event;
-}
+};
/**
* A state that represents if a WebSocket is connected.
@@ -1950,7 +1960,7 @@ type WebSocketReadyState = 0 | 1 | 2 | 3;
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
* @example
* const ws = new WebSocket("wss://ws.postman-echo.com/raw");
- *
+ *
* ws.addEventListener("open", () => {
* console.log("Connected");
* });
@@ -1986,7 +1996,7 @@ interface WebSocket extends EventTarget {
* - `4000` through `4999` are reserved for applications (you can use it!)
*
* To abruptly close the connection without a code, use `terminate()` instead.
- *
+ *
* @param code the close code
* @param reason the close reason
* @example
@@ -2127,7 +2137,7 @@ interface WebSocket extends EventTarget {
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
* @example
* const ws = new WebSocket("wss://ws.postman-echo.com/raw");
- *
+ *
* ws.addEventListener("open", () => {
* console.log("Connected");
* });
@@ -2141,10 +2151,7 @@ interface WebSocket extends EventTarget {
declare var WebSocket: {
prototype: WebSocket;
- new (
- url: string | URL,
- protocols?: string | string[],
- ): WebSocket;
+ new (url: string | URL, protocols?: string | string[]): WebSocket;
new (
url: string | URL,