-
Notifications
You must be signed in to change notification settings - Fork 52
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
optional: prop for partial keys #168
Comments
This is something that would be very useful to me. |
I actually think it needs to be
|
I have a different solution for this. It's a bit simpler. import * as L from 'monocle-ts/Lens';
function defaultValue<S, T>(value: T) {
return L.compose<S, T>(
L.lens(
(s) => (s ? (s as any as T) : value),
(a) => () => a as any as S
)
);
}
function modDeps<T>(deps: string[]) {
return pipe(
L.id<T>(),
L.prop('deps'),
defaultValue([]),
L.modify((s) => ...)
);
} |
🚀 Feature request
An export from the Optional module called
partial
.This request is in progress, I will advise when it's ready.
Current Behavior
There is no way to set a value on a deeply partial key.
Desired Behavior
Suggested Solution
Who does this impact? Who is this for?
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: