-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
concatLatestFrom doesnt work with navigate when selecting more than one selector #6830
Comments
After further investigation this appears to be a compile time error but the whole thing works fine if i explicitly tell the ts compiler to ignore the type error using ts-ignore but thats something that should not be intended behaviour |
The NgRx repository is an Nx repository so if it works on their side, this means this issue is not linked to Nx. |
The above example would work fine if i would swap navigation for NgRx |
@HarryPi Hi! Do you have a repo you could share that contains this code or this error? It's difficult to reproduce without being able to investigate your selectors and your |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
I still would be interested in this feature 😬 |
Hi @Coly010, apologies for the very late response.
If i find some free time i will create a repo, but as there are plenty of workarounds and in general more issues with the navigation than expected, i have taken a different aproach. |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
Commenting so I remember to look into this |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
I still have the issue |
I was able to reproduce locally. Will open a PR eventually. |
Looks like I get the exact same error with const testWithLatestFrom$ = createEffect(() => {
return (of() as Observable<Action>).pipe(
withLatestFrom((of() as Observable<number>), (of() as Observable<string>)),
/*
👇 Receive error below
TS2345: Argument of type '(source: ActionStateStream<unknown, Action>) => Observable<Action>' is not assignable to parameter of type 'OperatorFunction<[Action, number, string], Action>'.
Types of parameters 'source' and 'source' are incompatible.
Type 'Observable<[Action, number, string]>' is not assignable to type 'ActionStateStream<unknown, Action>'.
Type '[Action, number, string]' is not assignable to type 'ActionOrActionWithState<unknown, Action>'.
Type '[Action, number, string]' is not assignable to type '[Action, unknown]'.
Source has 3 element(s) but target allows only 2.
*/
navigation(AComponent, {
const testConcatLatestFrom$ = createEffect(() => {
return (of() as Observable<Action>).pipe(
concatLatestFrom(() => [(of() as Observable<number>), (of() as Observable<string>)]),
/*
👇 Receive error below
TS2345: Argument of type '(source: ActionStateStream<unknown, Action>) => Observable<Action>' is not assignable to parameter of type 'OperatorFunction<[Action, number, string], Action>'.
Types of parameters 'source' and 'source' are incompatible.
Type 'Observable<[Action, number, string]>' is not assignable to type 'ActionStateStream<unknown, Action>'.
Type '[Action, number, string]' is not assignable to type 'ActionOrActionWithState<unknown, Action>'.
Type '[Action, number, string]' is not assignable to type '[Action, unknown]'.
Source has 3 element(s) but target allows only 2.
*/
navigation(AComponent, { |
A breaking change that enables data persistence operators to be used in streams with more than one slice of data (e.g., with `withLatestFrom` and `concatLatestFrom`). Closes nrwl#6830
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
When passing 2 selectors as an array to concatLatestFrom there is a type mismatch error
Expected Behavior
Expected this to work as in NgRx repository this works and there is even a test for it to verify it works see https://github.com/ngrx/platform/blob/0bb49409413b784b1cc55c2b59e67ed760041aa5/modules/effects/spec/concat_latest_from.spec.ts#L87
Steps to Reproduce
I have an open issue on stackoverflow with a code example found here https://stackoverflow.com/q/68894745/6603342
But the ghist of it is
This will work fine if i use one selector or create a selector dedicated for combining the state i wish to extract, but not when passed as an array.
Note that this will also work just fine if i swap navigate for map, switchmap etc. or zip my two selectors.
Failure Logs
The error this produces is
Environment
The text was updated successfully, but these errors were encountered: