You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, if you have a deeply nested object, where each string property is a translation value, and the objects are just used for grouping. I would use Paths to overload the translation function, so I know which translation strings are available.
Or thinking about this differently, the type of would only return the leaf nodes of the tree.
Or can this already be achieved by filtering the strings first? I guess not. You need to store the type information in the type, because you need to traverse the type deeply before you can decide if you need to drop it.
Just so it doesn't get lost in the cracks, as the description doesn't further specify it: This issue now also tracks a onlyLeaves: true option as suggested in #432 (comment).
Would be great if you could specify which types you want in Paths.
For example if you have this type:
And you could filter only the strings via Paths, so that the resulting type is this:
"project" | "user.name.firstname" | "user.name.lastname"
For example, if you have a deeply nested object, where each string property is a translation value, and the objects are just used for grouping. I would use Paths to overload the translation function, so I know which translation strings are available.
Or thinking about this differently, the type of would only return the leaf nodes of the tree.
Or can this already be achieved by filtering the strings first? I guess not. You need to store the type information in the type, because you need to traverse the type deeply before you can decide if you need to drop it.
In the meantime, I'm using this: https://www.scalzotto.nl/posts/typescript-paths-and-leaves
Upvote & Fund
The text was updated successfully, but these errors were encountered: