xstate
xstate copied to clipboard
Deprecate `createModel(...)`
The createModel(...) function is now marked as deprecated, as it will be removed in XState version 5. It is recommended to use Typegen instead.
🦋 Changeset detected
Latest commit: 771ca1f291029864d624eba0ce2faa075d34c5a0
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
👇 Click on the image for a new way to code review
-
Make big changes easier — review code in small groups of related files
-
Know where to start — see the whole change at a glance
-
Take a code tour — explore the change with an interactive tour
-
Make comments and review — all fully sync’ed with github
Legend

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 771ca1f291029864d624eba0ce2faa075d34c5a0:
| Sandbox | Source |
|---|---|
| XState Example Template | Configuration |
| XState React Template | Configuration |
RIP createModel, you were a good experiment
Oh no 🙊
@davidkpiano Typegen has never been reliable for me, it can never cover all the userland requirements and sometimes it just doesn't work.

Is there any other way to allow the typing that createModel allowed, it's a lot nicer than passing generics to the assign method and doesn't require reliance on an extension.
@davidkpiano Typegen has never been reliable for me, it can never cover all the userland requirements and sometimes it just doesn't work.
Is there any other way to allow the typing that createModel allowed, it's a lot nicer than passing generics to the assign method and doesn't require reliance on an extension.
What specific things are you using createModel for besides assign?
Nothing outside of assign.
Usually actions with assigns, typically invoked.

Example of what it looks like after the model:

@davidkpiano After giving this some more thought, I've moved to using typescript narrowing which achieves the same thing.
