1

I want to turn this:

type SomeRecord = {member1: any, member2: any}

into this:

type ResultingTuple = [keyof SomeRecord, keyof SomeRecord]

If the record has 3 members, the tuple should have 3 elements, and so on.

Daniel Birowsky Popeski
  • 8,752
  • 12
  • 60
  • 125

1 Answers1

1

If we import TuplifyUnion from this answer, then :

type ResultingTuple = TuplifyUnion<keyof SomeRecord>

However, as mentioned by the author of TuplifyUnion, the order of the keys cannot be maintained.

Wong Jia Hau
  • 2,639
  • 2
  • 18
  • 30