Downcast Error types to ignore call signature

This helps type inference work correctly.
This commit is contained in:
Nathan Shively-Sanders
2018-11-20 11:31:32 -08:00
parent 9e68f23ebb
commit fd052a6b5a
+4 -4
View File
@@ -313,7 +313,7 @@ fooOrBarProm = fooProm.caught((error: any) => {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// $ExpectType Bluebird<void | Foo>
fooProm.catch(Error, (reason: any) => {
fooProm.catch(Error as { new(message?: string): Error }, (reason: any) => {
return;
});
// $ExpectType Bluebird<void | Foo>
@@ -321,7 +321,7 @@ fooProm.catch(Promise.CancellationError, (reason: any) => {
return;
});
// $ExpectType Bluebird<void | Foo>
fooProm.caught(Error, (reason: any) => {
fooProm.caught(Error as { new(message?: string): Error }, (reason: any) => {
return;
});
// $ExpectType Bluebird<void | Foo>
@@ -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) => {