From 9bbe0f196d863f586c1e02384f7d773d0af16296 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Wed, 14 Aug 2024 15:09:11 +0200 Subject: [PATCH] types: allow non strict HTTPMethod --- test/types/dispatcher.test-d.ts | 1 + types/dispatcher.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/types/dispatcher.test-d.ts b/test/types/dispatcher.test-d.ts index 303abd0ade7..1c84ed01443 100644 --- a/test/types/dispatcher.test-d.ts +++ b/test/types/dispatcher.test-d.ts @@ -35,6 +35,7 @@ expectAssignable(new Dispatcher()) expectAssignable(dispatcher.dispatch({ origin: '', path: '', method: 'GET', headers: mapHeaders, reset: true }, {})) expectAssignable(dispatcher.dispatch({ origin: '', path: '', method: 'GET', headers: iteratorHeaders, reset: true }, {})) expectAssignable(dispatcher.dispatch({ origin: new URL('http://localhost'), path: '', method: 'GET' }, {})) + expectAssignable(dispatcher.dispatch({ path: '', method: "CUSTOM" }, {})) // connect expectAssignable>(dispatcher.connect({ origin: '', path: '', maxRedirections: 0 })) diff --git a/types/dispatcher.d.ts b/types/dispatcher.d.ts index 6f33adc4a1d..eafa2e5907e 100644 --- a/types/dispatcher.d.ts +++ b/types/dispatcher.d.ts @@ -234,7 +234,7 @@ declare namespace Dispatcher { onBodySent?(chunkSize: number, totalBytesSent: number): void; } export type PipelineHandler = (data: PipelineHandlerData) => Readable; - export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; + export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH' | (string & Record); /** * @link https://fetch.spec.whatwg.org/#body-mixin