我想实现以下目标:
type FunctionType<T> = (a: T) => [T, string, T, T, string, T, number, number, T, string, number];
const A: <T extends {}>FunctionType<T> = (A) => [] as any
let b : FunctionType<string>
b = A("hello")
我希望能够静态生成泛型(例如第三行),因此以下方式不适合我的用例。
type FunctionType = <T>(a: T) => [T, string, T, T, string, T, number, number, T, string, number];
const A: FunctionType = (A) => [] as any
let b : FunctionType<string> // not working!
b = A("hello")