Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.75 KB

File metadata and controls

27 lines (18 loc) · 1.75 KB

Unbox hard #utils #promise #function #tuple #array

by Julian Coy @eXamadeus

Take the Challenge

How can we build a type that "unboxes" arrays, functions, promises, and tuples?

Example:

Unbox<string> // string
Unbox<()=>number> // number
Unbox<boolean[]> // boolean
Unbox<Promise<boolean>> // boolean

Bonus: Can we make it recursive?

Unbox<() => () => () => () => number> // number

Double Bonus: Can we control the recursion?

Unbox<() => () => () => () => number, 3> // () => number

Back Share your Solutions Check out Solutions