dot-diver
dot-diver copied to clipboard
Paths of properties of an object with index signature gets truncated.
See title. If we have a object inside a object with an index signature, all paths of the nested objects are getting truncated.
Example:
type TestType = {
[index: string]: {
a: string
b: number
}
}
// should be string | number | `${string}.a` | `${string}.b`
// but is string | number
type Paths = Path<TestType>
Typescript simplifies unions of string and template literals to only string, which truncates the template literals.
There are ways to fix this (using (string & {}) instead of just string) but these would damage readability of code auto completion or error messages.