Comments (3)
Yeah, unfortunately there's no support for null
yet. At some point I was pondering whether null
should be treated the same way as undefined
, so that e.g. optional()
and valueOr()
would consider null
a missing value.
from optics-ts.
What's a good way of working around this? Something with .lens()
?
from optics-ts.
For instance, @mnn, I think you could do this:
const xO = O.optic<ZNull>()
.prop('a')
.lens(
a => a ?? defaultA,
(a, update) => update,
)
.prop('b')
.lens(
b => b ?? defaultB,
(b, update) => update,
)
.prop('x');
from optics-ts.
Related Issues (20)
- DataCloneError: Failed to execute 'put' on 'IDBObjectStore': Symbol(__remove_me__) could not be cloned. HOT 2
- Setting property with value of empty object within list should not be undefined HOT 4
- Support JSON-Pointer RFC HOT 1
- `modify` does not work with `guard` prisms against union types when transforming focus type HOT 1
- [Feature] Data-first piping? HOT 1
- expose lens constructor? HOT 5
- TS is complaining when using Traversal HOT 2
- Does not type check correctly when loading from Deno HOT 1
- Maybe a better solution for this types on valueOr and optional? HOT 3
- Error: Unable to resolve HOT 2
- Setting a Prism should always apply no? HOT 1
- Possible to get the reverse of pick, like omit HOT 1
- a pick using optics
- Unable to resolve `optics-ts` when using moduleResolution nodenext in tsconfig
- "remove" doesn't really removes array element but rather replaces it with a `Symbol(__remove_me__)`
- Support readonly arrays HOT 1
- Release rewrite/reread optics HOT 1
- How to traverse `Record` types? HOT 7
- API to define recursive traversals HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optics-ts.