-
Notifications
You must be signed in to change notification settings - Fork 22
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
assoc
returns a narrower type than what is passed
#35
Comments
I've actually been working on this but had yet to push the branch up. I made a draft MR for you: #37 I still have a bunch of testing to do for the different overloads, but it does solve your issue Using your example: https://tsplay.dev/mqxg2N |
Wow, impressive - fixed the issue before it was even opened!! 👏🏻 👏🏻 👏🏻 Thank you for the diligent and speedy work! |
@ericyd The original MR that I referenced to fix your issue had Breaking changes and I was forced to leave hanging since we're still debating on if we want to merge it or not Prompted by another issue, I just put up a new MR that is non-breaking but also fixes your issue: #100 Sorry for letting this issue hang for so long |
Wow I just re-read my original bug report and the code snippet I provided is not even an accurate representation of the issue 🤣 Anyway, no worries on the delay. As things go, I was laid off from the job where I used ramda a bunch and now my new company uses lodash 🙄 Thanks for your dedication to this project 🙇🏻 Ramda is great and these types make it even better! |
Summary
assoc
sometimes returns a more narrow type than what is passed to it. Sinceassoc
never removes props, this feels wrong from a type perspective. I would expectassoc
to only add or modify props, never remove.In the example below, a complex type with 2 props is typed as
Record<'flag', bool>
after passing throughassoc
Dependencies
ramda@0.29.0
@types/ramda@0.29.1
typescript@5.0.2
Example
Error
The text was updated successfully, but these errors were encountered: