Skip to content

Commit 16074b0

Browse files
committed
fix: TypeScript errors during build
1 parent 8cb2e4e commit 16074b0

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/driver/postgres.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ export class PgDriver extends BaseDriver<never, never, PGTransaction> {
574574
});
575575
try {
576576
const results = await client.query<QueueRow>(q, v);
577-
if (results.rowCount < 1) {
577+
if ((results.rowCount as number) < 1) {
578578
throw new DriverNoMatchingAckError(ack);
579579
}
580580
} catch (e) {
@@ -624,7 +624,7 @@ export class PgDriver extends BaseDriver<never, never, PGTransaction> {
624624

625625
try {
626626
const results = await client.query<QueueRow>(q, v);
627-
if (results.rowCount < 1) {
627+
if ((results.rowCount as number) < 1) {
628628
throw new DriverNoMatchingAckError(ack);
629629
}
630630
} catch (e) {
@@ -720,7 +720,7 @@ export class PgDriver extends BaseDriver<never, never, PGTransaction> {
720720

721721
try {
722722
const results = await client.query<QueueRow>(q, v);
723-
if (results.rowCount < 1) {
723+
if ((results.rowCount as number) < 1) {
724724
throw new DriverNoMatchingAckError(ack);
725725
}
726726
} catch (e) {
@@ -759,7 +759,7 @@ export class PgDriver extends BaseDriver<never, never, PGTransaction> {
759759

760760
try {
761761
const results = await client.query<QueueRow>(q, v);
762-
if (results.rowCount < 1) {
762+
if ((results.rowCount as number) < 1) {
763763
throw new DriverNoMatchingRefError("ERR_UNKNOWN_ACK_OR_EXPIRED");
764764
}
765765
} catch (e) {
@@ -800,7 +800,7 @@ export class PgDriver extends BaseDriver<never, never, PGTransaction> {
800800
try {
801801
const results = await client.query<QueueRow>(q, v);
802802

803-
if (results.rowCount < 1) {
803+
if ((results.rowCount as number) < 1) {
804804
throw new DriverNoMatchingRefError(ref);
805805
}
806806
} catch (e) {

src/queue.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ export class Queue<
9292
protected stats: QueueStats;
9393

9494
/** Wrap the payload in a JSON encoding */
95-
static encodePayload(p: unknown) {
95+
static encodePayload(this: void, p: unknown) {
9696
return JSON.stringify({ _: p });
9797
}
9898

9999
/** Decode the payload, stripping away the outer JSON encoding */
100-
static decodePayload<T>(s: string | null | unknown) {
100+
static decodePayload<T>(this: void, s: string | null | unknown) {
101101
return JSON.parse((s as string) ?? "{}")._ as T;
102102
}
103103

@@ -117,8 +117,12 @@ export class Queue<
117117
},
118118
statInterval:
119119
options?.statInterval === 0 ? 0 : options?.statInterval ?? 5,
120-
decodePayload: options?.decodePayload ?? this.constructor.decodePayload,
121-
encodePayload: options?.encodePayload ?? this.constructor.encodePayload,
120+
decodePayload:
121+
options?.decodePayload ??
122+
(this.constructor as typeof Queue).decodePayload,
123+
encodePayload:
124+
options?.encodePayload ??
125+
(this.constructor as typeof Queue).encodePayload,
122126
};
123127

124128
// initialize stats

0 commit comments

Comments
 (0)