Skip to content

Commit

Permalink
Add back export of keys (#3113)
Browse files Browse the repository at this point in the history
* Add back export of keys

* Add changeset

* Update .changeset/kind-waves-provide.md

Co-authored-by: Mateusz Burzyński <[email protected]>
  • Loading branch information
davidkpiano and Andarist authored Mar 4, 2022
1 parent ab0b98e commit 144131b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-waves-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'xstate': patch
---

The `keys()` utility function export, which was removed in [#3089](https://github.com/statelyai/xstate/issues/3089), is now added back, as older versions of XState libraries may depend on it still. See [#3106](https://github.com/statelyai/xstate/issues/3106) for more details.
4 changes: 4 additions & 0 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import { State } from './State';
import { Actor } from './Actor';
import { AnyStateMachine } from '.';

export function keys<T extends object>(value: T): Array<keyof T & string> {
return Object.keys(value) as Array<keyof T & string>;
}

export function matchesState(
parentStateId: StateValue,
childStateId: StateValue,
Expand Down

0 comments on commit 144131b

Please sign in to comment.