Skip to content

Instantly share code, notes, and snippets.

@alex-okrushko
Last active April 3, 2019 15:05
Show Gist options
  • Save alex-okrushko/94a01594d92c37937985aaaedaa75271 to your computer and use it in GitHub Desktop.
Save alex-okrushko/94a01594d92c37937985aaaedaa75271 to your computer and use it in GitHub Desktop.
export class MyEffects {
constructor(private readonly actions$: Actions<ActionsUnion>) {}
@Effect
login$ = this.actions$.pipe(
// ensures type safety only when ActionsUnion is provided
ofType(login.type),
...
)
@Effect
login2$ = this.actions$.pipe(
// explicitly provided generic works as well
ofType<ReturnType<typeof login>>(login.type),
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment