bun-types 1.0.25 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,74 @@
1
+ declare module "bun" {
2
+ /**
3
+ * @deprecated Renamed to `ErrorLike`
4
+ */
5
+ type Errorlike = ErrorLike;
6
+ interface TLSOptions {
7
+ /**
8
+ * File path to a TLS key
9
+ *
10
+ * To enable TLS, this option is required.
11
+ *
12
+ * @deprecated since v0.6.3 - Use `key: Bun.file(path)` instead.
13
+ */
14
+ keyFile?: string;
15
+ /**
16
+ * File path to a TLS certificate
17
+ *
18
+ * To enable TLS, this option is required.
19
+ *
20
+ * @deprecated since v0.6.3 - Use `cert: Bun.file(path)` instead.
21
+ */
22
+ certFile?: string;
23
+ /**
24
+ * File path to a .pem file for a custom root CA
25
+ *
26
+ * @deprecated since v0.6.3 - Use `ca: Bun.file(path)` instead.
27
+ */
28
+ caFile?: string;
29
+ }
30
+ }
31
+
32
+ declare namespace NodeJS {
33
+ interface Process {
34
+ /**
35
+ * @deprecated This is deprecated; use the "node:assert" module instead.
36
+ */
37
+ assert(value: unknown, message?: string | Error): asserts value;
38
+ }
39
+ }
40
+
41
+ declare namespace Bun {
42
+ interface MessageEvent {
43
+ /** @deprecated */
44
+ initMessageEvent(
45
+ type: string,
46
+ bubbles?: boolean,
47
+ cancelable?: boolean,
48
+ data?: any,
49
+ origin?: string,
50
+ lastEventId?: string,
51
+ source?: null,
52
+ ): void;
53
+ }
54
+ }
55
+
56
+ interface CustomEvent<T = any> {
57
+ /** @deprecated */
58
+ initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void;
59
+ }
60
+
61
+ interface DOMException {
62
+ /** @deprecated */
63
+ readonly code: number;
64
+ }
65
+
66
+ /**
67
+ * @deprecated Renamed to `BuildMessage`
68
+ */
69
+ declare var BuildError: typeof BuildMessage;
70
+
71
+ /**
72
+ * @deprecated Renamed to `ResolveMessage`
73
+ */
74
+ declare var ResolveError: typeof ResolveMessage;
package/fetch.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
2
+
3
+ export interface Response extends _Response {}
4
+ export declare class Response {
5
+ constructor(body?: Bun.BodyInit | null | undefined, init?: Bun.ResponseInit | undefined);
6
+
7
+ /**
8
+ * Create a new {@link Response} with a JSON body
9
+ *
10
+ * @param body - The body of the response
11
+ * @param options - options to pass to the response
12
+ *
13
+ * @example
14
+ *
15
+ * ```ts
16
+ * const response = Response.json({hi: "there"});
17
+ * console.assert(
18
+ * await response.text(),
19
+ * `{"hi":"there"}`
20
+ * );
21
+ * ```
22
+ * -------
23
+ *
24
+ * This is syntactic sugar for:
25
+ * ```js
26
+ * new Response(JSON.stringify(body), {headers: { "Content-Type": "application/json" }})
27
+ * ```
28
+ * @link https://github.com/whatwg/fetch/issues/1389
29
+ */
30
+ static json(body?: any, options?: Bun.ResponseInit | number): Response;
31
+ /**
32
+ * Create a new {@link Response} that redirects to url
33
+ *
34
+ * @param url - the URL to redirect to
35
+ * @param status - the HTTP status code to use for the redirect
36
+ */
37
+ // tslint:disable-next-line:unified-signatures
38
+ static redirect(url: string, status?: number): Response;
39
+
40
+ /**
41
+ * Create a new {@link Response} that redirects to url
42
+ *
43
+ * @param url - the URL to redirect to
44
+ * @param options - options to pass to the response
45
+ */
46
+ // tslint:disable-next-line:unified-signatures
47
+ static redirect(url: string, options?: Bun.ResponseInit): Response;
48
+
49
+ /**
50
+ * Create a new {@link Response} that has a network error
51
+ */
52
+ static error(): Response;
53
+ }