Skip to content

Commit

Permalink
change to withType
Browse files Browse the repository at this point in the history
  • Loading branch information
agubler committed Jul 20, 2020
1 parent 2aaba40 commit 0234909
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ export interface DefaultMiddlewareResult extends MiddlewareResult<any, any, any,

export interface MiddlewareResultFactory<Props, Children, Middleware, ReturnValue> {
(): MiddlewareResult<Props, Children, Middleware, ReturnValue>;
returns: <Api extends ReturnValue, CustomProps = Props>() => MiddlewareResultFactory<
withType: <Api extends ReturnValue, CustomProps = Props>() => MiddlewareResultFactory<
CustomProps,
Children,
Middleware,
Expand Down
2 changes: 1 addition & 1 deletion src/core/middleware/icache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const icacheFactory = factory(
}
);

export const createICacheMiddleware = <S = void>() => icacheFactory.returns<ICacheResult<S>>();
export const createICacheMiddleware = <S = void>() => icacheFactory.withType<ICacheResult<S>>();

export const icache = createICacheMiddleware();

Expand Down
2 changes: 1 addition & 1 deletion src/core/middleware/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ const resourceMiddlewareFactory = factory(
);

export function createResourceMiddleware<MIDDLEWARE = void>() {
return resourceMiddlewareFactory.returns<
return resourceMiddlewareFactory.withType<
ResourceMiddleware<MIDDLEWARE>,
MIDDLEWARE extends void ? {} : ResourceMiddlewareProperties<MIDDLEWARE>
>();
Expand Down
2 changes: 1 addition & 1 deletion src/core/vdom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ function createFactory(callback: any, middlewares: any, key?: any): any {
return keys;
}, key ? [key] : []);

factory.returns = () => {
factory.withType = () => {
return factory;
};
callback.keys = keys;
Expand Down
5 changes: 4 additions & 1 deletion src/testing/harness/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export interface HarnessAPI {

interface HarnessOptions {
customComparator?: CustomComparator[];
middleware?: [MiddlewareResultFactory<any, any, any, any>, MiddlewareResultFactory<any, any, any, any>][];
middleware?: [
MiddlewareResultFactory<any, any, any, any>,
Exclude<keyof MiddlewareResultFactory<any, any, any, any>, 'withType'>
][];
}

const factory = create();
Expand Down
2 changes: 1 addition & 1 deletion src/testing/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ interface RendererOptions {
MiddlewareResultFactory<any, any, any, any>,
Pick<
MiddlewareResultFactory<any, any, any, any>,
Exclude<keyof MiddlewareResultFactory<any, any, any, any>, 'returns'>
Exclude<keyof MiddlewareResultFactory<any, any, any, any>, 'withType'>
>
][];
}
Expand Down

0 comments on commit 0234909

Please sign in to comment.