Repository navigation
Take one options object in createMachineContext factories - #244
Merged
Merged
Conversation
A factory declares the options it uses, input and layer, and each one is a Provider prop of the same name and type. A machine that needs only a capability layer no longer declares a placeholder input parameter. Options other than input and layer are rejected, and a factory without parameters, such as AtomMachine.factory for a machine without input, is still passed directly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9xMXPkpeqmvAbWNGY7R55
Contributor
Type performanceMeasured with TypeScript 6.0.3 and
Marginal instantiations are measured against the matching setup without that API call:
Check times (informational)
Type instantiations are the comparison metric. Check time varies with runner load and is informational only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createMachineContextfactories take no parameters or one options object. Each declared option,inputorlayer, is a required Provider prop of the same name and type.({ layer })instead of the(_: void, layer)placeholder.inputandlayerare a type error, so a capability cannot be passed under another name such asrouter.AtomMachine.factory(Machine)for a machine without input, is still passed directly and called without an options object.AtomMachine.factory(Machine)for a machine with input, is now a type error. Write({ input }: { input: Input }) => AtomMachine.make(Machine, input).Changeset
Minor changeset for
@typeonce/effect-machine-react, with the migration.Validation
pnpm checkEvery
pnpm checkstep passed locally, with two exceptions. The format check cannot download dprint plugins in this sandbox, so formatting was checked with the same plugin versions taken from npm. The devtools static-site test times out locally on unchangedmaintoo.pnpm perf:typespassed its budgets locally.Generated by Claude Code