Skip to content

Commit

Permalink
Fixed type of .events and .ownEvents properties (#4530)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored Nov 30, 2023
1 parent 355e896 commit 5dc9777
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/StateMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ import type {
Snapshot,
AnyActorLogic,
HistoryValue,
StateSchema
StateSchema,
EventDescriptor
} from './types.ts';
import { resolveReferencedActor } from './utils.ts';
import { $$ACTOR_TYPE, createActor } from './interpreter.ts';
Expand Down Expand Up @@ -112,7 +113,7 @@ export class StateMachine<
public id: string;

public states: StateNode<TContext, TEvent>['states'];
public events: Array<TEvent['type']>;
public events: Array<EventDescriptor<TEvent>>;

constructor(
/**
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/StateNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import type {
AnyStateMachine,
AnyStateNodeConfig,
ProvidedActor,
NonReducibleUnknown
NonReducibleUnknown,
EventDescriptor
} from './types.ts';
import {
createInvokeId,
Expand Down Expand Up @@ -420,7 +421,7 @@ export class StateNode<
/**
* All the event types accepted by this state node and its descendants.
*/
public get events(): Array<TEvent['type']> {
public get events(): Array<EventDescriptor<TEvent>> {
return memo(this, 'events', () => {
const { states } = this;
const events = new Set(this.ownEvents);
Expand All @@ -445,7 +446,7 @@ export class StateNode<
*
* Excludes any inert events.
*/
public get ownEvents(): Array<TEvent['type']> {
public get ownEvents(): Array<EventDescriptor<TEvent>> {
const events = new Set(
[...this.transitions.keys()].filter((descriptor) => {
return this.transitions
Expand Down

0 comments on commit 5dc9777

Please sign in to comment.