Open joseDaKing opened 2 years ago
I am currently building my own abstraction on top of styled-components and I won't my theme getters to be strictly typed.
type Theme = { colors: { blue: [ string, string, ], red: { a: string; b: string; } orange: Array<string>; }, } type Paths<Theme, "/"> = ...; // Type will be these values // "colors/blue/0" // "colors/blue/1" // "colors/red/a" // "colors/red/b" // `colors/orange/${number}`
Perhaps the Paths type could return instead tuples that resample the path and we could have a Join type to join the tuples with a delimiter.
Duplicate of #432
I'm keeping this issue open as a separator option can be added later on.
Fixed in https://github.com/sindresorhus/type-fest/pull/741?
I am currently building my own abstraction on top of styled-components and I won't my theme getters to be strictly typed.
Perhaps the Paths type could return instead tuples that resample the path and we could have a Join type to join the tuples with a delimiter.
Upvote & Fund