Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

128
Vistas
Type {properties .....} is not assignable to type ActionReducer<AdminState,Action> NGRX Angular 12

Using NGRX library for redux, trying to group the state of the application as below

export interface ApplicationState {
    adminState: AdminState
}

export interface AdminState {
    adminProductCategory: ProductCategoryState;
    adminProductVendor: VendorState;
    adminProductSubCategory: ProductSubCategoryState;
    products: ProductsState;
    product: ProductState
}

For the app module

imports: [
    StoreModule.forRoot(reducers, { metaReducers }),
    EffectsModule.forRoot([]),
    StoreDevtoolsModule.instrument({
      maxAge: 25
    })
  ],

Index.ts

export const reducers: ActionReducerMap<ApplicationState> = {
  adminState: AdminState = {
    adminProductCategory: AdminProductCategoryReducer,
    adminProductVendor: AdminProductVendorReducer,
    adminProductSubCategory: AdminProductSubCategoryReducer,
    products: ProductsReducer,
    product: ProductReducer,
  }
};


export const metaReducers: MetaReducer<ApplicationState>[] = [];

Exception

Type '{ adminProductCategory: (state: ProductCategoryState, action: Action) => any; adminProductVendor: (state: VendorState, action: Action) => any; adminProductSubCategory: (state: ProductSubCategoryState, action: Action) => any; products: (state: ProductsState, action: Action) => any; product: (state: ProductState, acti...' is not assignable to type 'ActionReducer<AdminState, Action>'.

'AdminState' only refers to a type, but is being used as a value here.

Reducer

export function AdminProductCategoryReducer(state: ProductCategoryState | undefined, action: Action): any {
  return reducer(state, action);
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're seeing this message because you're using the AdminState as a value adminState: AdminState within object brackets {}, which is allowed within class/function brackets only.

Try to remove the AdminState from this part of the code, and keep it like the following:

export const reducers: ActionReducerMap<ApplicationState> = {
  adminState: {
    adminProductCategory: AdminProductCategoryReducer,
    adminProductVendor: AdminProductVendorReducer,
    adminProductSubCategory: AdminProductSubCategoryReducer,
    products: ProductsReducer,
    product: ProductReducer,
  }
};
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda