-
-
Notifications
You must be signed in to change notification settings - Fork 568
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
Cannot copy Date type via CamelCasedPropertiesDeep #326
Comments
I think easiest solution here would be to add a new Some of these should be getting built in support though, like |
@voxpelli I'm thinking about add check like
This will copy type instead of iterating it and creating the new ones. |
A problem with that way is how TypeScript defines object: That its pure duck typing: As long as it looks like a duck, quacks like a duck, it is a duck. See eg this playground. A interface NonFake {
test: 'test'
}
interface NonFake2 {
test: 'test'
valueOf: () => boolean
}
interface FakeBoolean {
valueOf: () => boolean
} In other words: Any object that implements Because of that we can't really add these basic ones in my opinion, but we can add the more complex ones which are less likely to cause false positives. |
Did you mean create second optional type parameter that will be exceptional to deep copy? |
Yes, because then one adds it when one only adds it when one knows it won't create any false matches. |
It should use the same solution as done here: https://github.com/sdotson/type-fest/blob/da1a717790396afb0fab16dfc61f6d3df5d0b6fb/source/delimiter-cased-properties-deep.d.ts#L48 |
Fixed on #890 |
I'm currently using
CamelCasedPropertiesDeep
type and I found that it's not copy Date type, instead it creates copy of it. I've got this errorSo I tried it with another standard build-in object types and it works with none of them.
Here you can try to camelize keys of an object I've present above and notice this issue.
Upvote & Fund
The text was updated successfully, but these errors were encountered: