Description
Bug Report
π Search Terms
get type of a generic class method parse error
π Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about it.
β― Playground Link
Playground link with relevant code
π» Code
class Foo {
public bar<T extends string>(arg: T): T {
}
}
type fType = Foo['bar']<'test'> // ; expected
π Actual behavior
I'm not able to get the type of a generic method in a class. It results in a parse error.
π Expected behavior
Getting type of a generic method of a class should be possible.
Additional information
I need this to get the return type of a generic function from within to cast the return result (a workaround to to the bug with generic conditionals not resolving in certain cases).
It's not possible to just create a separate type to hold a reference to the method type because that type is not going to be a generic, and if you try to make a generic type out of it, it will result in the same problem. I'm not aware of any workarounds.