Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 2.4 KB

File metadata and controls

12 lines (8 loc) · 2.4 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

Related Challenges

10・Tuple to Union 11・Tuple to Object 472・Tuple to Enum Object 730・Union to Tuple