Type error with fetch operator and rxjs 7
See original GitHub issueA type error occurs when using the fetch operator with rxjs 7.
TS2322: Type 'Observable<unknown>' is not assignable to type 'EffectResult<Action>'. Type 'Observable<unknown>' is not assignable to type 'Observable<Action>'. Type 'unknown' is not assignable to type 'Action'
import {Injectable} from "@angular/core";
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { fetch } from '@nrwl/angular';
@Injectable()
class TodoEffects {
loadTodo$ = createEffect(() =>
this.actions$.pipe(
ofType('GET_TODO'),
fetch({
run: (action) => {
return ({
type: 'LOAD_TODO_SUCCESS',
});
},
})
)
);
constructor(private actions$: Actions) {}
}
When you downgrade to rxjs 6 the error disappears.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:13 (3 by maintainers)
Top Results From Across the Web
NgRX effects - Type 'Observable<unknown>' is not assignable ...
I agree, this error appears if one of the operators or observable "constructors" are not imported. But it also appears if types are...
Read more >RxJs Error Handling: Complete Practical Guide
The catchError operator takes as input an Observable that might error out, and starts emitting the values of the input Observable in its...
Read more >RxJS 6.x to 7.x Detailed Change List
This document contains a detailed list of changes between RxJS 6.x and RxJS 7.x, presented in the order they can be found when...
Read more >Chapter 7. Error handling with RxJS - RxJS in Action
The issues with imperative error–handling schemes; Using functional data types to abstract exception handling; Using observable operators to handle ...
Read more >What's New in RxJS 7 - Medium
The Promise returned by toPromise can indeed emit undefined . There is no way to tell the difference from an error state. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve found a solution for npm
In my case, I did https://github.com/nrwl/nx/discussions/10692#discussioncomment-3507611 and the error is gone. Not sure if its a correct solution but it does helped me.