gvergnaud / hotscript

A library of composable functions for the type-level! Transform your TypeScript types in any way you want using functions you already know.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Objects.PathTypeMap feature request

jessekelly881 opened this issue · comments

Something like this would be useful to be able to get the type at a given path, if possible.

/*
 * { "a": { b: number }, "a.b": number  }
 */
type Ret = Objects.PathTypeMap<{ a: { b: number } }>
commented

we have this :

type Res = $<Objects.Get, "a.b", { a: { b: number } } >;
//     ^? type Res = number

and this :

type Res = $<Objects.AllPaths, { a: { b: number } }>
//     ^? type Res = "a.b"

so you can combine both ?

Ooh. I overlooked Object.Get. That works. Thanks!