Would be great if you could specify which types you want in Paths.
For example if you have this type:
type Translations = {
project: string;
user: {
name: {
firstname: string;
lastname: string;
};
};
};
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
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too