type-challenges/questions/11-easy-restrict-key
Anthony Fu df6e22f105
New question Tuple to Object (#16)
Co-authored-by: sinoon <sinoon1218@gmail.com>
2020-07-29 16:27:49 +08:00
..
2020-07-29 16:27:49 +08:00
2020-07-29 16:27:49 +08:00
2020-07-29 16:27:49 +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 list = ['tesla', 'model 3', 'model X', 'model Y'] as const

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


Back Check out Solutions Share your Solutions