-
Notifications
You must be signed in to change notification settings - Fork 64
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
R.merge and type intersection #57
Comments
More info on this. It looks like the problem is a conflict in these two definitions: merge<T2>(a: R.placeholder, b: T2): <T1>(a: T1) => T1&T2;
merge<T1, T2>(a: T1, b: T2): T1 & T2; Removing the first one fixes the issue. I recommend reviewing (and possibly removing) the Incidentally, any |
I just came up with the same finding after 8 days ;) The placeholder thing is something I'm not happy with at all. It doesn't fit typescript well, although I do see its use-case. It is probably better to make a clear choice and just not support them at all. |
Agreed, we decided not to use |
I'll shoot a PR with the placeholders removed. If there are no serious objections, we remove them definitely. |
Cool @donnut , thanks! |
Hi, I'm having problems with
R.merge(a,b)
whereb
is a subset ofa
:The code above complains with:
If I explicitly state
T1
andT2
, the code works but it gets very ugly:Most of the time I use
R.merge
to update existing properties of immutable objects (like last in the example above). I think support for this use-case should be straight-forward. Worst case, this might be OKish:Having to specify the type of
{ last }
feels like an unnecessary pain.On a side note, for the use-case when I'm augmenting a type (i.e. A & B != A) I have no problem defining the new type.
The text was updated successfully, but these errors were encountered: