-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: type error when referencing guard with check
inside setup
#4834
Comments
It's both the same as the other issue and different. Some of the underlying mechanisms are the same but it feels like this one should be easier for TS to infer - something is obviously missing in the implementation there. Things break as soon as we include context-sensitive functions in I highly doubt it's fixable on our side right now (I intend to work on this in the compiler but it won't happen too soon). Our current best bet to work around this would be to introduce this API: #4703 |
XState version
XState version 5
Description
The
check
function provided byenqueueActions
can't be used to reference a guard bytype
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
The text was updated successfully, but these errors were encountered: