Skip to content

Commit 950b6fa

Browse files
matthewpMatthew Phillips
andauthored
revert: fix state type syntax error from PR #238 (#246)
* revert: fix state type syntax error from PR #238 Reverts the broken type definition that had a syntax error in the conditional type. The original change attempted to handle multiple transitions but introduced a parsing issue with missing space before '?' in the conditional type. This restores the working state function signature while we investigate a proper solution for multiple transition type inference. * add a changeset * properly update the package.json --------- Co-authored-by: Matthew Phillips <matthew@macmedia>
1 parent 0cf6366 commit 950b6fa

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

.changeset/soft-swans-heal.md

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+
Fix syntax error in state function type definition that caused TypeScript compilation failures. The previous change had a missing space in a conditional type expression, breaking type inference for state transitions.

package-lock.json

Lines changed: 20 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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[number] extends (Transition<infer F>)? F : string>;
61+
export function state<T extends Transition<any> | Immediate<any>>(
62+
...args: T[]
63+
): MachineState<T 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)