Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 1.39 KB

File metadata and controls

12 lines (8 loc) · 1.39 KB

Tuple to Nested Object medium #object

by jiangshan @jiangshanmeta

Take the Challenge

Given a tuple type T that only contains string type, and a type U, build an object recursively.

type a = TupleToNestedObject<['a'], string> // {a: string}
type b = TupleToNestedObject<['a', 'b'], number> // {a: {b: number}}
type c = TupleToNestedObject<[], boolean> // boolean. if the tuple is empty, just return the U type

Back Share your Solutions Check out Solutions