2

TS utility type Parameters<T> returns array of types:

const f = (a: number, b: boolean) => { 
  //...
}

// [a: number, b: boolean]
type FParams = Parameters<typeof f>;

I need to convert it to object of types:

[a: number, b: boolean] -> { a: number, b: boolean }

I have already seen these questions:

Typescript - Convert from Array of types to Object of types

Zip two types and make object type?

None of introduced variants works for me

Ken White
  • 123,280
  • 14
  • 225
  • 444
Mero
  • 630
  • 4
  • 12

0 Answers0