Skip to content
Discussion options

You must be logged in to vote

selectors need to be a type parameter too (and chances are you'll want name to be too, if you're using slice.selectors):

type CreateConfigSliceOptions<
  T,
  Name extends string,
  Reducers extends SliceCaseReducers<ConfigState<T>>,
  Selectors extends SliceSelectors<ConfigState<T>>,
> = {
  name: Name;
  initialState: ConfigState<T>;
  reducers: ValidateSliceCaseReducers<ConfigState<T>, Reducers>;
  selectors: Selectors;
};

export const createConfigSlice = <
  T,
  Name extends string,
  Reducers extends SliceCaseReducers<ConfigState<T>>,
  Selectors extends SliceSelectors<ConfigState<T>>,
>(
  options: CreateConfigSliceOptions<T, Name, Reducers, Selectors>,
) => {
  const { name, init…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@michalvadak
Comment options

@markerikson
Comment options

@michalvadak
Comment options

@EskiMojo14
Comment options

Answer selected by michalvadak
@michalvadak
Comment options

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