Skip to content

[question] Is it possible to obtain the variables and methods in the ASlice through get in the BSlice? #2949

Answered by dbritto-dev
liaodalin19903 asked this question in Q&A
Discussion options

You must be logged in to vote

@liaodalin19903 the type is wrong, should be

For CreateASlice

StateCreator<ASlice & BSlice, [], [], ASlice>

For CreateBSlice

StateCreator<ASlice & BSlice, [], [], BSlice>

In a nutshell

type State = SliceState1 & SliceState2 & SliceStateN

StateCreator<State, [], [], SliceStateN>

Ref: https://zustand.docs.pmnd.rs/guides/typescript#slices-pattern

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@liaodalin19903
Comment options

@dbritto-dev
Comment options

@liaodalin19903
Comment options

@dbritto-dev
Comment options

Answer selected by liaodalin19903
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants