-
Notifications
You must be signed in to change notification settings - Fork 89
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
Composition of Lenses do not type properly #714
Comments
I will sync with Ramda types and this should be fixed. I will post update as soon as I have it. |
TS-Version is 5.3.3 But isn't the import in the screenshot above coming from Ramda instead of Rambda? |
I wanted to first check how your example works in Ramda, so that I can aim for similar result |
The Ramda version needs the generics type info to work import * as R from 'ramda'
const quantityLens = R.lensProp<{ quantity: number }, 'quantity'>('quantity')
const composedLens = R.compose(quantityLens)
const result1 = R.view(quantityLens, { quantity: 5 })
const result2 = R.view(composedLens, { quantity: 5 }) |
The fact that rambda does not need the annotation |
I used your latest example with Rambda code. It is not great as If you have better suggestion how to fix this without this big change, I am open to your feedback. As I don't use lenses that much, I am not the best source for the correctness of their types, so I will do the fastest solution which is to sync. |
* split for.each * prepare x release * chore@small * chore@small * chore@small * chore@small * chore@small * fix@issue #710 * add gte * chore@small * chore@small * add typings * start reduce by * chore@small * fix@issue #714 sync types * chore@small * feat@inner.join * feat@build * fix test * chore@small * chore@small * chore@small * chore@small * chore@small * chore@small * chore@small * feat@fix * chore@small * chore@small --------- Co-authored-by: Deyan Totev <deyan.totev.extern@seven.one>
released with |
Issue
Composing functions of type R.Lens do not provide a proper Lens-Type.
Example:
One-Liner to demo the issue
Error:
Property 'set' is missing in type '(obj: unknown) => unknown' but required in type 'Lens'.ts(2741)
Maybe this is expected behavior. But it does work in Ramda - in that case, consider it a feature request instead of a bug.
Rambda version
8.6.0
Node.js version
20.6.1
The text was updated successfully, but these errors were encountered: