You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a project with @ngrx/scehmatics and @ngrx/effect
Generate a new module:
ng generate module test
Create a new feature with ngrx/schematics:
ng generate feature TestFeature
With default parameters it creates an invalid NGRX 11 effect:
export class TestFeatureEffects {
loadTestFeatures$ = createEffect(() => {
return this.actions$.pipe(
ofType(TestFeatureActions.loadTestFeatures),
/** An EMPTY observable only emits completion. Replace with your own observable API request */
concatMap(() => EMPTY)
);
});
constructor(private actions$: Actions) {}
}
It dispatches an EMPTY, what causes :
ERROR in src/app/test-module/effect-test-module/test/test-feature.effects.ts:14:36 - error TS2345: Argument of type '() => Observable<never>' is not assignable to parameter of type '() => never'.
Type 'Observable<never>' is not assignable to type 'never'.
14 loadTestFeatures$ = createEffect(() => {
~~~~~~~
According to the introduction of the new typechecks this is an error without specifying {dispatch: false} in the EffectConfig.
Expected behavior:
It creates a new effect with {dispatch: false}.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
Create a project with @ngrx/scehmatics and @ngrx/effect
Generate a new module:
ng generate module test
Create a new feature with ngrx/schematics:
ng generate feature TestFeature
With default parameters it creates an invalid NGRX 11 effect:
It dispatches an EMPTY, what causes :
According to the introduction of the new typechecks this is an error without specifying
{dispatch: false}
in the EffectConfig.Expected behavior:
It creates a new effect with
{dispatch: false}
.Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
NGRX 11.0.0 / @ngrx/schematics 11.0.0. / Angular 11.1.2
I believe it was introduced due to the stricter type-checks in NGRX 11, should work with pre-11 versions.
The text was updated successfully, but these errors were encountered: