|
| 1 | +/* |
| 2 | +Undici types need to be here because they are not exported to globals by @types/node. |
| 3 | +See https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/69408 |
| 4 | +
|
| 5 | +After the types are exported to globals, the Undici types can be removed from here. |
| 6 | +*/ |
| 7 | + |
| 8 | +type UndiciHeadersInit = |
| 9 | + | string[][] |
| 10 | + | Record<string, string | readonly string[]> |
| 11 | + | Headers; |
| 12 | + |
| 13 | +type UndiciBodyInit = |
| 14 | + | ArrayBuffer |
| 15 | + | AsyncIterable<Uint8Array> |
| 16 | + | Blob |
| 17 | + | FormData |
| 18 | + | Iterable<Uint8Array> |
| 19 | + | NodeJS.ArrayBufferView |
| 20 | + | URLSearchParams |
| 21 | + // eslint-disable-next-line @typescript-eslint/ban-types |
| 22 | + | null |
| 23 | + | string; |
| 24 | + |
| 25 | +type UndiciRequestRedirect = 'error' | 'follow' | 'manual'; |
| 26 | + |
| 27 | +type UndiciRequestCredentials = 'omit' | 'include' | 'same-origin'; |
| 28 | + |
| 29 | +type UndiciReferrerPolicy = |
| 30 | + | '' |
| 31 | + | 'no-referrer' |
| 32 | + | 'no-referrer-when-downgrade' |
| 33 | + | 'origin' |
| 34 | + | 'origin-when-cross-origin' |
| 35 | + | 'same-origin' |
| 36 | + | 'strict-origin' |
| 37 | + | 'strict-origin-when-cross-origin' |
| 38 | + | 'unsafe-url'; |
| 39 | + |
| 40 | +type UndiciRequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'; |
| 41 | + |
1 | 42 | type UndiciRequestInit = {
|
2 | 43 | method?: string;
|
3 | 44 | keepalive?: boolean;
|
4 |
| - headers?: HeadersInit; |
5 |
| - body?: BodyInit; |
6 |
| - redirect?: RequestRedirect; |
| 45 | + headers?: UndiciHeadersInit; |
| 46 | + body?: UndiciBodyInit; |
| 47 | + redirect?: UndiciRequestRedirect; |
7 | 48 | integrity?: string;
|
8 | 49 | signal?: AbortSignal | undefined;
|
9 |
| - credentials?: RequestCredentials; |
10 |
| - mode?: RequestMode; |
| 50 | + credentials?: UndiciRequestCredentials; |
| 51 | + mode?: UndiciRequestMode; |
11 | 52 | referrer?: string;
|
12 |
| - referrerPolicy?: ReferrerPolicy; |
| 53 | + referrerPolicy?: UndiciReferrerPolicy; |
13 | 54 | window?: undefined;
|
14 | 55 | dispatcher?: unknown;
|
15 | 56 | duplex?: unknown;
|
|
0 commit comments