angulartypescriptupgradengrxeffect

Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented


I'm upgrading a huge Angular 12 project to Angular 13 and did many steps. Effects were also rewritten in a newer way such as

createEffect(() =>

instead of

@Effect

Unfortunately, the upgrade caused several effects to be broken. The fast fix to avoid errors and run the app was to apply { dispatch: false }. Unfortunately, that was not a fix and it broke the logic. I've tried to fix each broken effect step by step. For one huge effect the error is: enter image description here which unexpectedly gets fixed by commenting

filter(...),

block , or another filter(...), block, or tap(..) in this large and long (many lines) Effect.

Are there limitations that I'm missing? Why is this error happening? Why it gets fixed by commenting simple pieces of this Effect?

As example, if I comment any of several filters in different places, as example this (params are renamed):

// filter(
//   ([
//     param1,
//     param2,
//     param3,
//     param4,
//     param5,
//     param6,
//     param7,
//     param8,
//     param9,
//     param10,
//     param11,
//     param12
//   ]) => !!param11.id
// ),

the error disappears: enter image description here


Solution

  • Adding any has helped:

    createEffect((): any => this.actions$.pipe(