#4834·xstate

Bug: type error when referencing guard with `check` inside `setup`

Author: with-heartCreated Apr 7, 2024Updated Sep 12, 2025
Labelsbug

XState version

XState version 5

Description

The check function provided by enqueueActions can't be used to reference a guard by type or by parameterized object.

Expected result

I expected check to not cause a type error when referencing a guard.

Actual result

check causes a type error when referencing a guard.

Reproduction

https://www.typescriptlang.org/play?ts=5.5.0-dev.20240331#code/JYWwDg9gTgLgBAbzgZwKYwK5gDR1QOwEcNUSBBAYxmAn2TgF84AzKCEOAIgA9kYBDGKk4BuOAHpxcGAE8wqZAC44AVgB0ATjUBGAFC60mMAAoEuuNLkLlZixYq0h3GDab96SGAAtg+AObK-PgyjNjmdqgAbgQwSohuHpbyypxYACaCwmLevgFwQSEMYRZF4fxUNHQ24RbpmQAqPv7KBMSkqJTUtMjGpnAUXqgUANaMAJRwALwAfIg1dsDMcMYDQ8PGnF7ujbkAwlv+qGmcYxO2diXzFovLqyN9sslcW8g7-vtBfkec42dXjPMGGNiqFwn4MPwoGk4ucLC83n4Poc0so+g58E4YLgojFxlNZrC7FB0BgoPh+o5UM41Dl-HAAISTSZ4aIYmlNPwiQEg0pArlAA

Additional context

Maybe related to the cause of #4820 but opening for tracking