Skip to content

Commit

Permalink
add declare and fix other issues with typescript types
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 4, 2024
1 parent d3e78b1 commit 3bfa755
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
export default class Kareem {
static skipWrappedFunction(): SkipWrappedFunction;
static overwriteMiddlewareResult(): OverwriteMiddlewareResult;
declare module "kareem" {
export default class Kareem {
static skipWrappedFunction(): SkipWrappedFunction;
static overwriteMiddlewareResult(): OverwriteMiddlewareResult;

pre(name: string | RegExp, fn: Function): this;
pre(name: string | RegExp, options: Record<string, any>, fn: Function, error?: any, unshift?: boolean): this;
post(name: string | RegExp, fn: Function): this;
post(name: string | RegExp, options: Record<string, any>, fn: Function, unshift?: boolean): this;
pre(name: string | RegExp, fn: Function): this;
pre(name: string | RegExp, options: Record<string, any>, fn: Function, error?: any, unshift?: boolean): this;
post(name: string | RegExp, fn: Function): this;
post(name: string | RegExp, options: Record<string, any>, fn: Function, unshift?: boolean): this;

clone(): this;
merge(other: Kareem, clone?: boolean): Kareem;
clone(): Kareem;
merge(other: Kareem, clone?: boolean): this;

createWrapper(name: string, fn: Function, context?: any, options?: any): Function;
createWrapperSync(name: string, fn: Function): Function;
hasHooks(name: string): boolean;
filter(fn: Function): Kareem;
createWrapper(name: string, fn: Function, context?: any, options?: any): Function;
createWrapperSync(name: string, fn: Function): Function;
hasHooks(name: string): boolean;
filter(fn: Function): Kareem;

wrap(name: string, fn: Function, context: any, args: any[], options?: any): Function;
wrap(name: string, fn: Function, context: any, args: any[], options?: any): Function;

execPostSync(name: string, context: any, args: any[]): any;
execPost(name: string, context: any, args: any[], options?: any, callback?: Function): void;
execPreSync(name: string, context: any, args: any[]): any;
execPre(name: string, context: any, args: any[], callback?: Function): void;
}

class SkipWrappedFunction {}
class OverwriteMiddlewareResult {}
execPostSync(name: string, context: any, args: any[]): any;
execPost(name: string, context: any, args: any[], options?: any, callback?: Function): void;
execPreSync(name: string, context: any, args: any[]): any;
execPre(name: string, context: any, args: any[], callback?: Function): void;
}

class SkipWrappedFunction {}
class OverwriteMiddlewareResult {}
}

0 comments on commit 3bfa755

Please sign in to comment.