Skip to content
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

Add model.createMachine(...) #2356

Merged
merged 5 commits into from
Jul 4, 2021
Merged

Conversation

davidkpiano
Copy link
Member

The model created from createModel(...) now provides a .createMachine(...) method that does not require passing any generic type parameters:

const model = createModel(/* ... */);

-const machine = createMachine<typeof model>(/* ... */);
+const machine = model.createMachine(/* ... */);

@changeset-bot
Copy link

changeset-bot bot commented Jun 28, 2021

🦋 Changeset detected

Latest commit: 6100fa0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
xstate Minor

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

@mattpocock
Copy link
Contributor

When you call model.createMachine without passing context, does it infer the context from the model? I'd expect that to happen.

@davidkpiano
Copy link
Member Author

When you call model.createMachine without passing context, does it infer the context from the model? I'd expect that to happen.

You mean the types or the actual value of the initialContext?

@mattpocock
Copy link
Contributor

The actual value

@davidkpiano
Copy link
Member Author

The actual value

Added here: 6100fa0

@davidkpiano davidkpiano requested a review from farskid June 30, 2021 14:52
@davidkpiano davidkpiano merged commit 0fa7571 into main Jul 4, 2021
@github-actions github-actions bot mentioned this pull request Jul 6, 2021
@Andarist Andarist deleted the davidkpiano/model-createMachine branch March 22, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants