Skip to content
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: typing breaks when using objects with params in the guard function and #5145

Open
melishev opened this issue Dec 14, 2024 · 1 comment
Labels

Comments

@melishev
Copy link

XState version

XState version 5

Description

Hi, awesome library, thank you so much for your work!

I want to combine defenders in my event, for example like this:

example: {
      on: {
        EVENT_NAME: {
          guard: and([
            'someGuard',
            {
              type: 'someGuard2',
              params: ({ event }) => ({ some: event.some }),
            },
          ]),
        },
      },

I decided to try this because I saw such a case study in your test files, but didn't check their execution

But in a case like this I run into two problems:

  1. Typing doesn't work (suppose you don't accept such a case, then it's logical)
  2. Guard is not called at all

If this case is not admissible, could you then highlight how I can solve my problem?

Expected result

I expect the syntax I'm using will work with the new fix version

Actual result

not work

Reproduction

--

Additional context

No response

@melishev melishev added the bug label Dec 14, 2024
@melishev
Copy link
Author

Sorry, it's my mistake, I tried your tests, tried my code and everything is ok.

The only problem is with types, this syntax breaks typing, are there any plans for this?

@melishev melishev changed the title Bug: passing dynamic parameters does not work when using and([]) in guard Bug: typing breaks when using objects with params in the guard function and Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant