Is it possible for a class with a generic such as class Foo<A> {}
to access A
's prototype or use a typeguard on A
, or run any sort of logic based on A
's type alone - without having been provided the class, interface, or instance to Foo
's constructor (i.e. Foo
has no constructor or the constructor does not accept an argument of type A
)?
There are several answers about accessing the constructor, such as Generic Type Inference with Class Argument but I am only interested in running different logic based on the type, not instantiating a new instance of it.
Specifically, I want to know if A.prototype
has a certain method defined on it.