Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(effects): inline ngrxOnRunEffects type #2208

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions modules/effects/src/effect_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { mergeEffects } from './effects_resolver';
import {
onIdentifyEffectsKey,
onRunEffectsKey,
onRunEffectsFn,
OnRunEffects,
onInitEffects,
} from './lifecycle_hooks';
Expand All @@ -30,7 +29,7 @@ export class EffectSources extends Subject<any> {
super();
}

addEffects(effectSourceInstance: any) {
addEffects(effectSourceInstance: any): void {
this.next(effectSourceInstance);

if (
Expand Down Expand Up @@ -91,9 +90,9 @@ function resolveEffectSource(
};
}

function isOnRunEffects(sourceInstance: {
[onRunEffectsKey]?: onRunEffectsFn;
}): sourceInstance is OnRunEffects {
function isOnRunEffects(
sourceInstance: Partial<OnRunEffects>
): sourceInstance is OnRunEffects {
const source = getSourceForInstance(sourceInstance);

return (
Expand Down
8 changes: 3 additions & 5 deletions modules/effects/src/lifecycle_hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ export interface OnIdentifyEffects {
export const onIdentifyEffectsKey: keyof OnIdentifyEffects =
'ngrxOnIdentifyEffects';

export type onRunEffectsFn = (
resolvedEffects$: Observable<EffectNotification>
) => Observable<EffectNotification>;

/**
* @description
* Interface to control the lifecycle of effects.
Expand Down Expand Up @@ -73,7 +69,9 @@ export interface OnRunEffects {
* @description
* Method to control the lifecycle of effects.
*/
ngrxOnRunEffects: onRunEffectsFn;
ngrxOnRunEffects(
resolvedEffects$: Observable<EffectNotification>
): Observable<EffectNotification>;
}

export const onRunEffectsKey: keyof OnRunEffects = 'ngrxOnRunEffects';
Expand Down