-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[core] Tighten StateMachine
types and fix issue #5008
#5009
[core] Tighten StateMachine
types and fix issue #5008
#5009
Conversation
🦋 Changeset detectedLatest commit: 3059beb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@@ -413,33 +413,33 @@ describe('state tests', () => { | |||
}); | |||
|
|||
it('should test with input', () => { | |||
const model = createTestModel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a little weird too... for some reason, TS complained if setup(…)
was inside createTestModel(setup(…).createMachine(…))
but not if I moved it outside.
…n-type' of https://github.com/statelyai/xstate into davidkpiano/5008-bug-5170-property-machine-is-missing-in-type
TEmitted extends EventObject = EventObject, // TODO: remove default | ||
TMeta extends MetaObject = MetaObject, | ||
TConfig extends StateSchema = StateSchema | ||
TEmitted extends EventObject, | ||
TMeta extends MetaObject, | ||
TConfig extends StateSchema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change. By having these as optional, we were (well, at least I was) miscounting the generic type params, and some were erroneously using their default types.
The internal types for
StateMachine<...>
have been improved so that all type params are required, to prevent errors when using the types. This fixes weird issues like #5008.