Skip to content

Commit

Permalink
Add typing for Response.redirect(url, status) (#1169)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w committed Nov 5, 2021
1 parent 2d80b0b commit ff7e950
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions @types/index.d.ts
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions @types/index.test-d.ts
Expand Up @@ -88,6 +88,9 @@ async function run() {
new Map([['a', null], ['3', null]]).keys()
]);
/* eslint-enable no-new */

expectType<Response>(Response.redirect('https://google.com'));
expectType<Response>(Response.redirect('https://google.com', 301));
}

run().finally(() => {
Expand Down

0 comments on commit ff7e950

Please sign in to comment.