Skip to content

Commit

Permalink
export messenger
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Feb 2, 2025
1 parent fac8735 commit 4650d99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/egg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,5 +696,6 @@ declare module '@eggjs/core' {
curl<T = any>(url: HttpClientRequestURL, options?: HttpClientRequestOptions): Promise<HttpClientResponse<T>>;
createAnonymousContext(req?: any): EggContext;
runInAnonymousContextScope(scope: (ctx: Context) => Promise<void>, req?: unknown): Promise<void>;
readonly messenger: IMessenger;
}
}
3 changes: 3 additions & 0 deletions test/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import {
Singleton,
} from '../src/index.js';
import { HttpClient } from '../src/urllib.js';
import { IMessenger } from '../src/lib/core/messenger/IMessenger.js';

const app = {} as EggCore;
expectType<IMessenger>(app.messenger);
expectType<IMessenger>(app.messenger.broadcast('test'));
const ctx = app.createAnonymousContext();

expectType<Promise<void>>(app.runInAnonymousContextScope(async ctx => {
Expand Down

0 comments on commit 4650d99

Please sign in to comment.