improvement - generic Effect interface
MODIFY
example/controllers.ts
example/controllers.ts
import { filter, map } from 'rxjs/operators';
-import { RequestEffect } from '../src';
+import { Effect, EffectResponse } from '../src';
import { StatusCode } from '../src/util';
-export const root$: RequestEffect = request$ => request$
+export const root$: Effect = request$ => request$
.pipe(
filter(http => http.url === '/'),
map(http => ({
@@ -11,7 +11,7 @@ export const root$: RequestEffect = request$ => request$
}))
);
-export const hello$: RequestEffect = request$ => request$
+export const hello$: Effect = request$ => request$
.pipe(
filter(http => http.url === '/hello'),
map(http => ({

MODIFY
src/effects/effects.interface.ts
src/effects/effects.interface.ts
@@ -8,7 +8,7 @@ export type EffectResponse = {
headers?: Record<string, string>,
};
-export type RequestEffect = (
+export type Effect<T = EffectResponse> = (
request$: Observable<HttpRequest>,
response?: HttpResponse,
-) => Observable<EffectResponse>;
+) => Observable<T>;

improvement - generic Effect interface