Tuple to Object

@type-challenges
Last updated 30 days ago
EASY

Given an array, transform it into an object type and the key/value must be in the provided array.

For example:

const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const type result = TupleToObject<typeof tuple> // expected { 'tesla': 'tesla', 'model 3': 'model 3', 'model X': 'model X', 'model Y': 'model Y'}

This challenge was ported from Type Challenges and was authored by sinoon

Loading...
Loading...