`coerce()` should run recursively (and not assert)
See original GitHub issueRight now, it’s impossible to coerce a nested structure, both because coerce()
also validates (#467 ) but also because coerce()
only runs on the top-level object. For instance, coerce({}, type({...props}))
will fail, even if all props have coercions, because they never run.
coerce()
should function parallel to check()
(preferably with a context object). In the case of validate-with-coerce, they could still run like now, in tandem.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top Results From Across the Web
performance - Recursion or Iteration? - Stack Overflow
If your recursive method takes longer to execute then the calling context management part, go the recursive way as the code is generally...
Read more >Why use a recursive function instead of an iterative function?
An assignment had us convert an iterative function in an old program from a previous assignment into a recursive function. I don't understand ......
Read more >AssertJ - fluent assertions java library - GitHub Pages
Setting comparators must be done before calling the assertion otherwise it is ignored as a failing assertion breaks will prevent the call to...
Read more >Documentation - TypeScript 3.7
asserts condition says that whatever gets passed into the condition parameter must be true if the assert returns (because otherwise it would throw...
Read more >Recursion and linked lists - CS 2112/ENGRD 2112 Fall 2019
This recursive definition not only makes sense mathematically, ... For recursive code to be correct, the base case of the recursion must eventually...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, I’m sorry. I lost the thread a little. I think this probably deserves a bug report. I’d you look at the code, type is definitely supposed to be recursive. I can say I’ve found union to be a little finicky myself, so I’d be willing to be the problem is there.
But does it work recursively? I’m running into an issue where its not validating nested structures, resulting in
Not sure if its a bug I should make an example for, or if
create
is not intended to be recursive fortype
objects as mentioned earlier in this threadI’ll try to check more directly today to see if I can answer my own question. Read this thread and assumed it wasn’t supported.