-
-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Labels
Description
Maybe related to #583
(new CustomError) instanceof CustomError
// => false
// should be `true` but will get `false` @ ts-node
// `true` @ node
In addition, constructor
also works unexpectedly.
(new WithoutConstructorError).constructor === WithoutConstructorError // => false
(new WithoutConstructorError).constructor === Error // => true
I've tested using following code.
Adding constructor
in class did not change result.
class WithoutConstructorError extends Error {}
(new Error).name
(new WithoutConstructorError).name
(new Error) instanceof Error
(new Error) instanceof WithoutConstructorError
(new WithoutConstructorError) instanceof WithoutConstructorError
(new WithoutConstructorError) instanceof Error
(new Error).constructor === Error
(new Error).constructor === WithoutConstructorError
(new WithoutConstructorError).constructor === WithoutConstructorError
(new WithoutConstructorError).constructor === Error
davoam