Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paths of properties of an object with index signature gets truncated. #2

Closed
djfhe opened this issue Mar 24, 2023 · 0 comments · Fixed by #11
Closed

Paths of properties of an object with index signature gets truncated. #2

djfhe opened this issue Mar 24, 2023 · 0 comments · Fixed by #11
Labels
enhancement New feature or request

Comments

@djfhe
Copy link
Member

djfhe commented Mar 24, 2023

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.

@djfhe djfhe changed the title Paths of nested objects inside object with index singature gets truncated. Paths of nested objects inside object with index signature gets truncated. Mar 26, 2023
@djfhe djfhe changed the title Paths of nested objects inside object with index signature gets truncated. Paths of properties of an object with index signature gets truncated. Mar 26, 2023
@saibotk saibotk added the enhancement New feature or request label Mar 27, 2023
@djfhe djfhe mentioned this issue Mar 27, 2024
Merged
@djfhe djfhe closed this as completed in #11 Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants