Conversation
🦋 Changeset detectedLatest commit: 8fcbddd The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 0fe1e18:
|
|
Really like this idea. Captures more interesting visualizable intent, too! Given the variadic signature, wondering if |
|
After further thought, now I've convinced myself you had it right with 🤷 |
| guard: { | ||
| type: 'testGuard', | ||
| name: 'any', | ||
| children: [ |
There was a problem hiding this comment.
I'm not super convinced that having a custom predicate that is responsible for resolving its children is a good idea - if u need something like this you can already use params, shouldn't children just be reserved for combinators like not, and and or?
In other words - could u prepare a real-life example of such a thing used in practice?
There was a problem hiding this comment.
if u need something like this you can already use
params
Not exactly, since params are just params - they're not resolved. children are resolved.
The usefulness of this is so that custom guards that might need to reference other guards can be made in userland (such as xor(...), etc.).
|
@davidkpiano |
This PR aims to simplify the implementation details and TS types for guards, as well as adds the following higher-level guards:
and([someGuard, anotherGuard, ...])or([someGuard, anotherGuard, ...])not(someGuard)These higher-level guards can be combined at any depth:
And parameterized guards can use these higher-level guards:
It also will rename
condtoguardin transitions, as this has been a common source of confusion.TODO:
and([...])+ testsor([...])+ testsnot(...)+ testsAdd other boolean guards (if applicable)Enable "guard definitions" in(not in this PR)guardsinstead of just predicatescondtoguards