From f6ad637869f632c85f6767079fbf041dbd75c1ac Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Wed, 13 Mar 2024 21:39:22 -0700 Subject: [PATCH] types: align RequestInit.body type with lib.dom.ts (#2956) Allow null. --- test/types/fetch.test-d.ts | 1 + types/fetch.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/types/fetch.test-d.ts b/test/types/fetch.test-d.ts index 59fb49fc3e8..b06e50ac480 100644 --- a/test/types/fetch.test-d.ts +++ b/test/types/fetch.test-d.ts @@ -31,6 +31,7 @@ const requestInit2: RequestInit = { const requestInit3: RequestInit = {} // Test assignment. See https://github.com/whatwg/fetch/issues/1445 requestInit3.credentials = 'include' +const requestInit4: RequestInit = { body: null } declare const request: Request declare const headers: Headers diff --git a/types/fetch.d.ts b/types/fetch.d.ts index 68779da13ba..d51311b13df 100644 --- a/types/fetch.d.ts +++ b/types/fetch.d.ts @@ -122,7 +122,7 @@ export interface RequestInit { method?: string keepalive?: boolean headers?: HeadersInit - body?: BodyInit + body?: BodyInit | null redirect?: RequestRedirect integrity?: string signal?: AbortSignal | null