1

In the type, is it possible to convert the array type to the object type?

enter image description here

class Ad {
    constructor(name: string, age: number) {}
}
type Ac = ConstructorParameters<typeof Ad>
// Ac = [name: string, age: number]

i want this

type ?<T> = {...}
type Ac2 = ?<Ac>
// type Ac2 = {
//    name: string
//    age: number
//}
Dan Bonachea
  • 2,408
  • 5
  • 16
  • 31
maskletter
  • 11
  • 2
  • Your actually asking for named tuple to object conversion -- https://stackoverflow.com/questions/69687087/transform-named-tuple-to-object. – spinkus Jan 08 '23 at 04:33

0 Answers0