Skip to content

Type does not flow properly when using the set during creation #2665

Closed Answered by dbritto-dev
jsgoupil asked this question in Bug report
Discussion options

You must be logged in to vote

BTW, you don't need to explicitly type your store, you can use combine middleware to get fully inferred types ->

create(
  combine({ count: 0 }, (set) => ({
    increment: () => {
      set((state) => ({ count: state.count + 1 }));
    },
  })),
);

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@jsgoupil
Comment options

Comment options

You must be logged in to vote
2 replies
@jsgoupil
Comment options

@dbritto-dev
Comment options

Answer selected by jsgoupil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants