Use Case
I have a class that is constructed by passing in a list of methods and then lets you call those methods through the class (the class adds some additional functionality). These methods have the class (Foo) bound as their context when being called. So I have a FooMethod type.
class Foo {
public constructor(methods) {}
}
const myMethod: FooMethod<number> = function(value: number): number {
return value
}
const myMethods = [myMethod]
const foo = new Foo(myMethods)
type FooMethod<T> = (this: typeof foo, ...args: any[]) => T
type MyMethodParameters = Parameters<typeof myMethod> // any[]
Issue
By adding the type FooMethod<number> to the myMethod const. I can no longer get the type of the arguments for the function by doing Parameters<typeof myMethod>
Question
Is there a way to have the FooMethod type still infer the arguments? I'd like to be able to do Parameters<typeof myMethod> and still get [number]