You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
614 B

1 month ago
  1. import actualApply from './actualApply';
  2. type TupleSplitHead<T extends any[], N extends number> = T['length'] extends N
  3. ? T
  4. : T extends [...infer R, any]
  5. ? TupleSplitHead<R, N>
  6. : never
  7. type TupleSplitTail<T, N extends number, O extends any[] = []> = O['length'] extends N
  8. ? T
  9. : T extends [infer F, ...infer R]
  10. ? TupleSplitTail<[...R], N, [...O, F]>
  11. : never
  12. type TupleSplit<T extends any[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>]
  13. declare function applyBind(...args: TupleSplit<Parameters<typeof actualApply>, 2>[1]): ReturnType<typeof actualApply>;
  14. export = applyBind;