This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DeepObjectKeys<T> = T extends Record<string, unknown> | |
? { | |
[K in keyof T]-?: K extends string ? `${K}` | `${K}.${DeepObjectKeys<T[K]>}` : never | |
}[keyof T] | |
: never | |
const testObj = { | |
foo: { | |
bar: false, | |
baz: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// So let's say we have a string of known parts, Str | |
type Foo = 'foo' | |
type Bar = 'bar' | |
type Baz = 'baz' | |
type Str = `${Foo}.${Bar}.${Baz}` | |
const str: Str = 'foo.bar.baz' | |
// I want to split it into the known parts, | |
// Which I can do in a nice way with this Split type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Ansi 5 Color" : { | |
"Red Component" : 0.82745098039215681, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.50980392156862742, | |
"Green Component" : 0.21176470588235294 | |
}, | |
"Tags" : [ | |
], |