type-challenges/questions/11-easy-tuple-to-object
2020-07-31 17:50:09 +08:00
..
2020-07-29 16:35:24 +08:00
2020-07-29 16:35:24 +08:00
2020-07-31 17:50:09 +08:00
2020-07-29 16:35:24 +08:00
2020-07-29 16:35:24 +08:00

Tuple to Object easy

by sinoon @sinoon

Take the Challenge

Given an array, transform to a object type and the key/value must in the given array.

For example

const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const

const result: TupleToObject<tuple> // expected { tesla: 'tesla', 'model 3': 'model 3', 'model X': 'model X', 'model Y': 'model Y'}

Back Share your Solutions Check out Solutions