I use ngrx in my Angular 12 project and wanted to implement the ngrx-store-logger to log my actions and store. Here's part of my app.module.ts
import { storeLogger } from 'ngrx-store-logger';
import { environment } from 'src/environments/environment';
export function logger(reducer: ActionReducer<AppState>): any {
// default, no options
return storeLogger()(reducer);
}
export const metaReducers = !environment.production? [logger] : [];
@NgModule({
declarations: [ ... ]
imports: [... StoreModule.forRoot(reducers, { metaReducers }), ... ]
...
}
VSC throws this error:
Types of parameters 'reducer' and 'reducer' are incompatible.
Type '{ [x: string]: any; }' is missing the following properties from type 'AppState': students, coachests(2322)
while my build executes without errors, there's just not any logging when executing any actions at all.
Seems like I used the wrong reducer in my StoreModule. That fixed it!