platform icon indicating copy to clipboard operation
platform copied to clipboard

EntityAdapter.getSelectors(selectState) has wrong typing

Open bryanforbes opened this issue 3 years ago • 4 comments

Minimal reproduction of the bug/regression with instructions:

https://stackblitz.com/edit/ngrx-seed-wyr8ke?file=src%2Fapp%2Freducers%2Fusers.reducer.ts

At line 22 of app/reducers/users.reducer.ts of the above StackBlitz, the typing of the users selector is (state: UsersAppState) => Users[]. This isn't a big issue with applications, but is most notable in unit tests because MockStore.overrideSelector() requires a MemoizedSelector.

Expected behavior:

The typing of the users selector should be MemoizedSelector<UsersAppState, User[], DefaultProjectorFn<User[]>> when passing a selectState selector.

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

NgRx: 10.0.0 Angular: n/a

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

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

bryanforbes avatar Oct 20 '20 17:10 bryanforbes

Same pb here when trying to use the MemoizedSelector.projector in tests.

bbaia avatar Dec 15 '20 14:12 bbaia

Is there anything we can do to help get this PR merged ? It would be nice to finally have those types fixed.

Lakston avatar Jan 25 '21 13:01 Lakston

Last time the ngrx team aimed to allow the overrideSelector to accept non memoized selector as well instead of adjusting the getSelectors. https://github.com/ngrx/platform/pull/2502

I hope someone can get it done this time - fingers crossed :)

twittwer avatar Jan 25 '21 15:01 twittwer

Hi, as mentioned in #2978 the docs don't link to the correct interface. I'll gladly update this PR with some update to the docs, but I can't find how to update it. Could someone point me in the good direction ? 😄

aymeric-duchein avatar Apr 23 '21 15:04 aymeric-duchein

Hi, as mentioned in https://github.com/ngrx/platform/issues/2978 the docs don't link to the correct interface. I'll gladly update this PR with some update to the docs, but I can't find how to update it. Could someone point me in the good direction ? smile

Bump this issue for the documentation error.

cl-parsons avatar Jul 05 '23 16:07 cl-parsons