-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
toJS
breaks type compatibility between records with object values
#1930
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
Comments
Hi @thatsmydoing . Thanks for the report. #1932 should fix this. About the fact that you do prefer "old" types : there was I'm trying to improve the types one step at a time, but it might break sometime on some implementation, despite the fact that I add unit tests and I test it on a project with ~250 TS files and a lot of immutable code. Feel free to report any issue you might have on TS types though, I will try to do my best to fix them as soon as possible. |
Indeed, but typescript is also about being pragmatic with types and I think the previous typing for I do appreciate getting better typing in though, so if you can make it work that's great. But otherwise, I wouldn't mind just having more conservative types. |
@thatsmydoing Can you try patching your local immutable definition file and test the fix to see if it does work for you? |
The linked PR has fixed the
errors with
There's also a small part of our code where 4.1 -> 4.2 broke some generic type inference but I don't know if that can be reasonably fixed. |
Hm, actually the
it fixes our type inference issues. |
About About your proposal, I will check that, but that exactly what |
As a matter of fact, I do test Can you maybe provide another minimal reproductible case that I can check ? |
Indeed, but The type inference issue we ran into is:
with the relevant error being
What happens is that it's not successfully inferring |
What happened
Records with object values that would otherwise be compatible are not because of
toJS
. I've noticed this when fields only differ by optionality.How to reproduce
Results in the error
I think this happens due to the workaround for circular types where objects become
unknown
. Honestly, I think the new types are more trouble than they're worth and would prefer the 4.1 types.The text was updated successfully, but these errors were encountered: