From ff7e95035929dea83e296b4fabe56adf7af36985 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Fri, 5 Nov 2021 06:31:14 -0400 Subject: [PATCH] Add typing for Response.redirect(url, status) (#1169) --- @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 7dbc05ef0..c7207c435 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts @@ -177,6 +177,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(() => {