Skip to content

Commit

Permalink
fix(core/create): fixes input intercept types
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Oct 24, 2019
1 parent f04a018 commit 1de6069
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function before<T>(
factory(...args: any) {
const fn = hook.factory.apply(this, args);
return function(data, context, info, next) {
const get = async (): Promise<T> => fn(data, context, info);
const get = async (): Promise<T | void> => fn(data, context, info);
return from(get()).pipe(
switchMap((value) => next(value === undefined ? data : value))
);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/create/implement/intercepts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ export type HookCreateInputResolve<T = any, C = any> = (
data: T,
context: C,
info: ElementInfo
) => T | Promise<T>;
) => T | void | Promise<T | void>;
4 changes: 2 additions & 2 deletions packages/core/src/create/implement/services/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { Observable } from 'rxjs';
export interface UnaryServiceImplementationInput<I = any, O = any, C = any> {
types?: ServiceInputTypes;
resolve: (data: I, context: C) => Promise<O> | O;
intercepts?: Array<InterceptImplementation<I, O>>;
intercepts?: Array<InterceptImplementation<I, O, C>>;
}

export interface StreamServiceImplementationInput<I = any, O = any, C = any> {
types?: ServiceInputTypes;
resolve: (data: I, context: C) => Observable<O> | Promise<Observable<O>>;
intercepts?: Array<InterceptImplementation<I, O>>;
intercepts?: Array<InterceptImplementation<I, O, C>>;
}

export interface ServiceInputTypes {
Expand Down

0 comments on commit 1de6069

Please sign in to comment.