Skip to content

Commit 1d6179a

Browse files
kybargmatthewp
andauthored
fix: state type (#238)
* fix: state type * chore: update * Update .changeset/curvy-balloons-confess.md --------- Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
1 parent 92cb118 commit 1d6179a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"robot3": patch
3+
---
4+
5+
Fixes types for the state() function.

packages/core/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ declare module 'robot3' {
5858
*
5959
* @param args - Any argument needs to be of type Transition or Immediate.
6060
*/
61-
export function state<T extends Transition<any> | Immediate<any>>(
62-
...args: T[]
63-
): MachineState<T extends Transition<infer F> ? F : string>;
61+
export function state<T extends (Transition<any> | Immediate<any>)[]>(
62+
...args: T
63+
): MachineState<T[number] extends (Transition<infer F>)? F : string>;
6464

6565
/**
6666
* A `transition` function is used to move from one state to another.

0 commit comments

Comments
 (0)