hotscript
hotscript copied to clipboard
Objects TerminalPaths
trafficstars
Introduces a few nice functions
type res1 = Call<
// ^? "object.nested" | "tuple[0]" | "tuple[1]"
Objects.TerminalPaths,
{
object: {
nested: boolean;
};
tuple: [0, 1];
>;
type res1 = Call<
// ^? ["a", string] | ["b.c", number] | ["b.d[0].f", boolean]
Objects.DeepEntries,
{ a: string; b: { c: number; d: [{ f: boolean }] } }
>;
type res1 = Call<
// ^? { a: string; b: { c: number } & { d: { 0: { f: boolean } } } }
Objects.FromDeepEntries,
["a", string] | ["b.c", number] | ["b.d[0].f", boolean]
>;
I would rename DeepEntries to DeepPathEntries and FromDeepEntries to FromDeepPathEntries