feature: improve isInstance type definition #2233
Labels
flag: needs discussion
Issues which needs discussion before implementation.
type: feature
Issues related to new features.
Description
isInstance
type definition could be improved. Currently the type definition is as follows:However this does not tell Typescript that object is indeed a type of
new (...args: any[]) => any
. So whenever you want to do something like:Proposed solution
It should be simple if we just use a type predicate:
and use it like
In fact I'm using this in my code already.
The text was updated successfully, but these errors were encountered: