Skip to content

Commit

Permalink
fix: export types from index
Browse files Browse the repository at this point in the history
  • Loading branch information
feywind committed Oct 23, 2024
1 parent 0dfc9e6 commit f152573
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/async-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import {Message} from './subscriber';
* Represents an async function that can process a message and return
* a Promise for the function's completion.
*/
export interface UserHandler {
export interface AsyncMessageHandler {
(message: Message): Promise<void>;
}

/**
* A handler for sub.on('message', x) that can be passed to .on() to do
* the async processing in this class.
*/
export interface StreamHandler {
export interface StreamMessageHandler {
(message: Message): void;
}

Expand Down Expand Up @@ -66,19 +66,19 @@ export class AsyncHelper {
tailPromise: Promise<void> = Promise.resolve();

// The user's handler that will be called to take a message and get back a Promise.
userHandler: UserHandler;
userHandler: AsyncMessageHandler;

/**
* @param userHandler The async function we'll call for each message.
*/
constructor(userHandler: UserHandler) {
constructor(userHandler: AsyncMessageHandler) {
this.userHandler = userHandler;
}

/**
* A handler function that you can pass to .on('message').
*/
get handler(): StreamHandler {
get handler(): StreamMessageHandler {
return this.streamHandler.bind(this);
}

Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ export {
} from './topic';
export {Duration, TotalOfUnit, DurationLike} from './temporal';
export {DebugMessage} from './debug';
export {
AsyncHelper,
AsyncMessageHandler,
StreamMessageHandler,
} from './async-helper';

if (process.env.DEBUG_GRPC) {
console.info('gRPC logging set to verbose');
Expand Down

0 comments on commit f152573

Please sign in to comment.