Skip to content

Commit

Permalink
fix(core): enhance typings for async hooks, fix #363
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Aug 23, 2021
1 parent e9e52a1 commit 401655b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/koishi-core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Router from '@koa/router'
export type NextFunction = (next?: NextFunction) => Promise<void>
export type Middleware = (session: Session, next: NextFunction) => any
export type Promisify<T> = T extends Promise<unknown> ? T : Promise<T>
export type Awaitable<T> = T extends Promise<unknown> ? T : T | Promise<T>
export type Awaitable<T> = [T] extends [Promise<unknown>] ? T : T | Promise<T>
export type Await<T> = T extends Promise<infer U> ? U : T
export type Disposable = () => void

Expand Down Expand Up @@ -380,7 +380,7 @@ export class Context {
const dispose = this.on(name, function (...args: any[]) {
dispose()
return listener.apply(this, args)
} as any, prepend)
}, prepend)
return dispose
}

Expand Down

0 comments on commit 401655b

Please sign in to comment.