From fd052a6b5a37f5125f2f0b750090902ec41908fa Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 20 Nov 2018 11:31:32 -0800 Subject: [PATCH] Downcast Error types to ignore call signature This helps type inference work correctly. --- types/bluebird/bluebird-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/bluebird/bluebird-tests.ts b/types/bluebird/bluebird-tests.ts index 05ac5cc19c..8fe5db7538 100644 --- a/types/bluebird/bluebird-tests.ts +++ b/types/bluebird/bluebird-tests.ts @@ -313,7 +313,7 @@ fooOrBarProm = fooProm.caught((error: any) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // $ExpectType Bluebird -fooProm.catch(Error, (reason: any) => { +fooProm.catch(Error as { new(message?: string): Error }, (reason: any) => { return; }); // $ExpectType Bluebird @@ -321,7 +321,7 @@ fooProm.catch(Promise.CancellationError, (reason: any) => { return; }); // $ExpectType Bluebird -fooProm.caught(Error, (reason: any) => { +fooProm.caught(Error as { new(message?: string): Error }, (reason: any) => { return; }); // $ExpectType Bluebird @@ -329,13 +329,13 @@ fooProm.caught(Promise.CancellationError, (reason: any) => { return; }); -fooOrBarProm = fooProm.catch(Error, (reason: any) => { +fooOrBarProm = fooProm.catch(Error as { new(message?: string): Error }, (reason: any) => { return bar; }); fooOrBarProm = fooProm.catch(Promise.CancellationError, (reason: any) => { return bar; }); -fooOrBarProm = fooProm.caught(Error, (reason: any) => { +fooOrBarProm = fooProm.caught(Error as { new(message?: string): Error }, (reason: any) => { return bar; }); fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {