Skip to content

Potential breaking change in @ngrx/store 12.5.0 #3173

@nicholas-ochoa

Description

@nicholas-ochoa

It appears that a small change was made based on pull request #3158 that changes the behavior from the previous version (12.4) with the store.select() types. There was no mention of this change in the CHANGELOG.md file for 12.5, however my application was broken until I rolled back to 12.4 and did some digging on what changed.

The code I'm currently using (which works today on 12.4):

loadPalletTypesList$ = this.store.select(fromList.selectLoadPalletTypesList);

Error message received after upgrading to 12.5:

Error: projects/go/src/app/load/services/load.service.ts:45:44 - error TS2769: No overload matches this call.
  Overload 1 of 9, '(mapFn: (state: Record<string, unknown>) => DataList): Observable<DataList>', gave the following error.
    Argument of type 'MemoizedSelector<AppState, DataList, DefaultProjectorFn<DataList>>' is not assignable to parameter of type '(state: Record<string, unknown>) => DataList'.
  Overload 2 of 9, '(key: string): Observable<unknown>', gave the following error.
    Argument of type 'MemoizedSelector<AppState, DataList, DefaultProjectorFn<DataList>>' is not assignable to parameter of type 'string'.

45   loadPalletTypesList$ = this.store.select(fromList.selectLoadPalletTypesList);

It's not a huge issue, but I think the change should be mentioned in the CHANGELOG.md as a potential problem.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

Angular 12.5
NgRx 12.5
Node 14.17.5
TS: 4.4.4

Other information:

I would be willing to submit a PR to fix this issue

[ ] Yes (Assistance is provided if you need help submitting a pull request)
[X] No

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions