-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Object.Paths broken with TS 4.9 #322
Comments
Same issue here, anyone has any idea how to sort that out? It seems the lib is abandoned =/ |
I just wrote my own version to replace it. Probably going to be doing that for the rest of my ts-toolbelt usages too |
I'm having that same issue here, TypeScript 4.8 works just fine! |
Damn, ran into the same issue on my end @bissolli :D very sad. |
As we were not using the lib extensively we ended up removing the lib as it seems to be abandoned! |
This ObjectPaths type is the code I used to replace ts-toolbelt's
|
I actually found this code online somewhere, does the same thing... export type NestedKeyPaths<ObjectType extends object> = {
[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
? `${Key}.${NestedKeyPaths<ObjectType[Key]>}`
: `${Key}`;
}[keyof ObjectType & (string | number)]; |
👍 That code is similar to mine, but doesn't handle unions or circular types |
🐞 Bug Report
Describe the bug
Object.Paths doesn't seem to be working right with 4.9. Not sure where the bug is
Reproduce the bug
https://www.typescriptlang.org/play?ts=4.9.0-dev.20221011#code/JYWwDg9gTgLgBAbzgeQEYCsCmBjeBfOAMyghDgHIYBnAWhgggBtVNGZyBuAKC5gE8wmOGACGMABZU4AXhQYcMAHQAFMZIA8Sca0YQAXHCowowAHYBzOHgB8HIA
paths
is of typereadonly Key[]
in 4.9Expected behavior
The same snippet running in 4.8
https://www.typescriptlang.org/play?ts=4.8.4&ssl=3&ssc=46&pln=3&pc=44#code/JYWwDg9gTgLgBAbzgeQEYCsCmBjeBfOAMyghDgHIYBnAWhgggBtVNGZyBuAKC5gE8wmOGACGMABZU4AXhQYcMAHQAFMZIA8Sca0YQAXHCowowAHYBzOHgB8HIA
Possible Solution
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: