nx: Type error with fetch operator and rxjs 7

A 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.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I’ve found a solution for npm