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

updated State interface value type #1388

Merged
merged 3 commits into from
Aug 18, 2020

Conversation

hudecsamuel
Copy link
Contributor

@hudecsamuel hudecsamuel commented Aug 18, 2020

Fixes typing of value in State interface
I was using an enum for the states and discovered that the value is still strings no matter what

export enum States {
  flow = 'flow',
  search = 'search',
  default = 'default',
}

type HeaderState =
  | {
      value: States.flow
      context:{
    }
  | {
      value: States.search
      context: {}
    }
  | {
      value: States.default
      context: {}
    }

const machine = createMachine<HeaderMachineContext, HeaderEvents, HeaderState>(...)

...

machineState.value // the type should be `States` instead of `string`

@changeset-bot
Copy link

changeset-bot bot commented Aug 18, 2020

🦋 Changeset is good to go

Latest commit: 0ee3553

We got this.

This PR includes changesets to release 1 package
Name Type
@xstate/fsm Patch

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

@Andarist
Copy link
Member

@hudecsamuel could you include a changeset for this change?

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 18, 2020

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 0ee3553:

Sandbox Source
XState Example Template Configuration
XState React Template Configuration

@hudecsamuel
Copy link
Contributor Author

@Andarist Done.

@davidkpiano davidkpiano merged commit 1212d0b into statelyai:master Aug 18, 2020
@github-actions github-actions bot mentioned this pull request Aug 18, 2020
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