Skip to content

@xstate/store@4.1.0

Choose a tag to compare

@github-actions github-actions released this 29 May 16:36
· 6 commits to main since this release
9d9b9f1

Minor Changes

  • #5530 0502c04 Thanks @davidkpiano! - Expose store.schemas so integrations can read the store's context, event, and emitted event schemas at runtime.

    const store = createStore({
      schemas: {
        context: z.object({ count: z.number() }),
        events: {
          inc: z.object({ by: z.number() })
        }
      },
      context: { count: 0 },
      on: {
        inc: (context, event) => ({ count: context.count + event.by })
      }
    });
    
    store.schemas?.events?.inc;