mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Downcast Error types to ignore call signature
This helps type inference work correctly.
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user