You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to have a utility method that can query if a Type<ts.Type> is callable.
The existing queries that can be performed on a Type<ts.Type>, such as isObject(), isNumber(), isLiteral(), etc. seem straightforward, though I don't see anything to check if a type is a method, function, callable etc.
A callable type could be far up an inheritance chain from the raw Function or (...args: any[]) => any types, so I assume this could be difficult to check. I also noticed that isObject() returns true for callables (since they're considered first class objects in js/ts anyway).
I've considered the following alternative, though it doesn't seem to work as expected, might have some risky edgecases, and and looks expensive to run.
It would be useful to have a utility method that can query if a
Type<ts.Type>
is callable.The existing queries that can be performed on a
Type<ts.Type>
, such as isObject(), isNumber(), isLiteral(), etc. seem straightforward, though I don't see anything to check if a type is a method, function, callable etc.A callable type could be far up an inheritance chain from the raw
Function
or(...args: any[]) => any
types, so I assume this could be difficult to check. I also noticed that isObject() returns true for callables (since they're considered first class objects in js/ts anyway).I've considered the following alternative, though it doesn't seem to work as expected, might have some risky edgecases, and and looks expensive to run.
The text was updated successfully, but these errors were encountered: