Closed gabrielmcreynolds closed 2 months ago
Closing this as duplicate of #54
I keep that one open as a feature request, but I probably won't get to it in a while. I would accept a PR though.
The issue is this can't be a modification of the normal .copyWith, since a) there isn't something like "default generic params" which would break any existing code using it and b) the generic property would have to be required. So if impemented then as a new method e.g. ".copyWithType
It would be very helpful if the generated copyWith function supported changing generics. For example, if I have a class that has a generic property, I would like to be able to change the generic type of the class with
copyWith
. Here is an example of what I have in mind:Currently, without the generics I get a type error saying:
Thanks for your work on this package and not sure if this is possible but it would be helpful!