Skip to content

Commit 1edbb82

Browse files
committed
[LINT] type it dispatcher references correctly so that the API usage is not flagged by the linter
1 parent 386f5aa commit 1edbb82

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

nats-base-client/nats.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import type { RequestManyOptionsInternal } from "./request.ts";
2929

3030
import { isRequestError } from "./msg.ts";
3131
import { createInbox, ErrorCode, RequestStrategy } from "./core.ts";
32+
import type { Dispatcher } from "./core.ts";
3233

3334
import type {
3435
ConnectionOptions,
@@ -51,7 +52,7 @@ export class NatsConnectionImpl implements NatsConnection {
5152
options: ConnectionOptions;
5253
protocol!: ProtocolHandler;
5354
draining: boolean;
54-
listeners: QueuedIterator<Status>[];
55+
listeners: Dispatcher<Status>[];
5556

5657
private constructor(opts: ConnectionOptions) {
5758
this.draining = false;

nats-base-client/protocol.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import type {
4545
Payload,
4646
Publisher,
4747
PublishOptions,
48-
QueuedIterator,
4948
Request,
5049
Server,
5150
ServerInfo,
@@ -381,7 +380,7 @@ export class ProtocolHandler implements Dispatcher<ParserEvent> {
381380
publisher: Publisher;
382381
_closed: boolean;
383382
closed: Deferred<Error | void>;
384-
listeners: QueuedIterator<Status>[];
383+
listeners: QueuedIteratorImpl<Status>[];
385384
heartbeats: Heartbeat;
386385
parser: Parser;
387386
outMsgs: number;

nats-base-client/queued_iterator.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class QueuedIteratorImpl<T> implements QueuedIterator<T>, Dispatcher<T> {
5858
iterClosed: Deferred<void | Error>;
5959
done: boolean;
6060
signal: Deferred<void>;
61-
yields: T | CallbackFn[];
61+
yields: (T | CallbackFn)[];
6262
filtered: number;
6363
pendingFiltered: number;
6464
ingestionFilterFn?: IngestionFilterFn<T>;
@@ -148,15 +148,15 @@ export class QueuedIteratorImpl<T> implements QueuedIterator<T>, Dispatcher<T> {
148148
}
149149
// only pass messages that pass the filter
150150
const ok = this.protocolFilterFn
151-
? this.protocolFilterFn(yields[i])
151+
? this.protocolFilterFn(yields[i] as T)
152152
: true;
153153
if (ok) {
154154
this.processed++;
155155
const start = Date.now();
156-
yield yields[i];
156+
yield yields[i] as T;
157157
this.time = Date.now() - start;
158158
if (this.dispatchedFn && yields[i]) {
159-
this.dispatchedFn(yields[i]);
159+
this.dispatchedFn(yields[i] as T);
160160
}
161161
} else {
162162
this.pendingFiltered--;

0 commit comments

Comments
 (0)