Skip to content

Commit

Permalink
refactor(effects): inline ngrxOnRunEffects type (#2208)
Browse files Browse the repository at this point in the history
  • Loading branch information
L2jLiga authored and brandonroberts committed Nov 7, 2019
1 parent 354fd05 commit fe1dfc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
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

0 comments on commit fe1dfc1

Please sign in to comment.