Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
jindong.zhang committed Feb 13, 2022
1 parent 46f1a30 commit e53396f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .changeset/sour-lies-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'xstate': patch
---

Added the `AnyStateConfig` type, which represents any `StateConfig<...>`:

```ts
import type { AnyStateConfig } from 'xstate';
import { State } from 'xstate';

// Retrieving the state config from localStorage
const stateConfig: AnyStateConfig = JSON.parse(
localStorage.getItem('app-state')
);

// Use State.create() to restore state from config object with correct type
const previousState = State.create(stateConfig);
```

0 comments on commit e53396f

Please sign in to comment.