作者:xie392地址:https://v.douyin.com/ieQtfv3e/更新时间:2024-12-21
1type Curried<T, K> = T extends []2? () => K3: T extends [infer AGR]4? (params: AGR) => K5: T extends [infer AGR, ...infer REST]6? (params: AGR) => Curried<REST, K>7: never89declare function curry<T extends any[], K>(fn: (...args: T) => K): Curried<T, K>1011function sum(a: string, b: number, c:object) {12return a + b13}1415const curryFn = curry(sum)1617curryFn('sss')(333)({a:1})