From 5664c8c4006c39ec0f461d31bd1e95c07588b926 Mon Sep 17 00:00:00 2001 From: Jan Chren ~rindeal Date: Mon, 9 Sep 2024 05:23:38 +0000 Subject: [PATCH] fix(types): add missing `cache` prop to RequestInit Also sort the props. See: https://github.com/nodejs/undici/blob/dca0aa0998cbdef28916b23d6300beb2fd979140/lib/web/fetch/request.js#L974-L979 --- test/types/fetch.test-d.ts | 13 +++++++------ types/fetch.d.ts | 17 +++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/test/types/fetch.test-d.ts b/test/types/fetch.test-d.ts index 68d69c0f4ab..218850bc5b6 100644 --- a/test/types/fetch.test-d.ts +++ b/test/types/fetch.test-d.ts @@ -38,17 +38,18 @@ declare const request: Request declare const headers: Headers declare const response: Response -expectType(requestInit.method) -expectType(requestInit.keepalive) -expectType(requestInit.headers) expectType(requestInit.body) -expectType(requestInit.redirect) -expectType(requestInit.integrity) -expectType(requestInit.signal) +expectType(requestInit.cache) expectType(requestInit.credentials) +expectType(requestInit.headers) +expectType(requestInit.integrity) +expectType(requestInit.keepalive) +expectType(requestInit.method) expectType(requestInit.mode) +expectType(requestInit.redirect) expectType(requestInit.referrer) expectType(requestInit.referrerPolicy) +expectType(requestInit.signal) expectType(requestInit.window) expectType(requestInit2.dispatcher) diff --git a/types/fetch.d.ts b/types/fetch.d.ts index 7c2b1c98ccd..4edf41eb055 100644 --- a/types/fetch.d.ts +++ b/types/fetch.d.ts @@ -119,20 +119,21 @@ type RequestDestination = | 'xslt' export interface RequestInit { - method?: string - keepalive?: boolean - headers?: HeadersInit body?: BodyInit | null - redirect?: RequestRedirect - integrity?: string - signal?: AbortSignal | null + cache?: RequestCache credentials?: RequestCredentials + dispatcher?: Dispatcher + duplex?: RequestDuplex + headers?: HeadersInit + integrity?: string + keepalive?: boolean + method?: string mode?: RequestMode + redirect?: RequestRedirect referrer?: string referrerPolicy?: ReferrerPolicy + signal?: AbortSignal | null window?: null - dispatcher?: Dispatcher - duplex?: RequestDuplex } export type ReferrerPolicy =