From 4344efdf840323ed9a0db380f9a63a413feccd53 Mon Sep 17 00:00:00 2001 From: Marcus Cemes <20288819+MarcusCemes@users.noreply.github.com> Date: Mon, 29 Apr 2019 08:18:13 +0200 Subject: [PATCH] [express-serve-static-core] Correct overload for Response.download() (#35043) * [express-serve-static-core] Correct overload for Response.download() * [express-serve-static-core] Unify res.sendFile and res.download overloads --- types/express-serve-static-core/index.d.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index 334d09eac0..2e431d8ad3 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -575,10 +575,8 @@ export interface Response extends http.ServerResponse, Express.Response { * * @api public */ - sendFile(path: string): void; - sendFile(path: string, options: any): void; - sendFile(path: string, fn: Errback): void; - sendFile(path: string, options: any, fn: Errback): void; + sendFile(path: string, fn?: Errback): void; + sendFile(path: string, options: any, fn?: Errback): void; /** * @deprecated Use sendFile instead. @@ -610,11 +608,9 @@ export interface Response extends http.ServerResponse, Express.Response { * * This method uses `res.sendfile()`. */ - download(path: string): void; - download(path: string, filename: string): void; - download(path: string, fn: Errback): void; - download(path: string, filename: string, fn: Errback): void; - download(path: string, filename: string, options: any, fn: Errback): void; + download(path: string, fn?: Errback): void; + download(path: string, filename: string, fn?: Errback): void; + download(path: string, filename: string, options: any, fn?: Errback): void; /** * Set _Content-Type_ response header with `type` through `mime.lookup()`