Skip to content

Commit

Permalink
feat: improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackGlory committed May 8, 2024
1 parent d0a9ace commit 49c0ec4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ function useForceUpdate(): () => void

### useFiniteStateMachine
```ts
function useFiniteStateMachine<State extends string, Event extends string>(
function useFiniteStateMachine<
State extends string | number | symbol
, Event extends string | number | symbol
>(
schema: IFiniteStateMachineSchema<State, Event>
, initialState: State
): ObservableFiniteStateMachine<State, Event>
Expand Down
5 changes: 4 additions & 1 deletion src/use-finite-state-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export type {
, IFiniteStateMachineSchema
} from 'extra-fsm'

export function useFiniteStateMachine<State extends string, Event extends string>(
export function useFiniteStateMachine<
State extends string | number | symbol
, Event extends string | number | symbol
>(
schema: IFiniteStateMachineSchema<State, Event>
, initialState: State
): ObservableFiniteStateMachine<State, Event> {
Expand Down

0 comments on commit 49c0ec4

Please sign in to comment.