develwoutacause’s avatardevelwoutacause’s Twitter Archive—№ 1,366

  1. RT @aleksandrasays: ✨TypeScript utility type for today ✨ easily extend existing function's parameters:
    type AddParameters<
  TFn extends (...args: never[]) => void,
  TParams extends [...args: unknown[]],
> = (...args: [...Parameters<TFn>, ...TParams]) 
    => ReturnType<TFn>
  
type One = (x: number) => void
// type Two = (x: number, y: string) => void
type Two = AddParameters<One, [y: string]>