From ea783a0ba37011cb4506843f53954aca5d018987 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Mon, 24 May 2021 20:07:18 -0400 Subject: [PATCH] Add typing for Response.redirect(url, status) --- @types/index.d.ts | 1 + @types/index.test-d.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/@types/index.d.ts b/@types/index.d.ts index 9854261f2..959d9b0a5 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts @@ -157,6 +157,7 @@ export class Response extends BodyMixin { clone(): Response; static error(): Response; + static redirect(url: string, status?: number): Response; } export class FetchError extends Error { diff --git a/@types/index.test-d.ts b/@types/index.test-d.ts index 4b280f1cd..4b24dcbb1 100644 --- a/@types/index.test-d.ts +++ b/@types/index.test-d.ts @@ -88,6 +88,9 @@ async function run() { new Map([['a', null], ['3', null]]).keys() ]); /* eslint-enable no-new */ + + expectType(Response.redirect('https://google.com')); + expectType(Response.redirect('https://google.com', 301)); } run().finally(() => {