Skip to content

Commit

Permalink
Merge pull request #37 from mongoosejs/vkarpov15/typescript
Browse files Browse the repository at this point in the history
add typescript types
  • Loading branch information
vkarpov15 authored Mar 4, 2024
2 parents 6883699 + 20bb652 commit 4e5624d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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;

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

createWrapper(name: string, fn: Function, context?: any, options?: Record<string, 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?: Record<string, any>): Function;

execPostSync(name: string, context: any, args: any[]): any;
execPost(name: string, context: any, args: any[], options?: Record<string, 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 4e5624d

Please sign in to comment.