Protocol: lint fixes for client/program

This commit is contained in:
Peter Steinberger
2025-12-09 15:18:34 +01:00
parent d1217e84c7
commit cf5769753a
4 changed files with 54 additions and 23 deletions

View File

@@ -11,8 +11,8 @@ import {
} from "./protocol/index.js";
type Pending = {
resolve: (value: any) => void;
reject: (err: any) => void;
resolve: (value: unknown) => void;
reject: (err: unknown) => void;
expectFinal: boolean;
};
@@ -167,7 +167,11 @@ export class GatewayClient {
}
const expectFinal = opts?.expectFinal === true;
const p = new Promise<T>((resolve, reject) => {
this.pending.set(id, { resolve, reject, expectFinal });
this.pending.set(id, {
resolve: (value) => resolve(value as T),
reject,
expectFinal,
});
});
this.ws.send(JSON.stringify(frame));
return p;

View File

@@ -9,31 +9,31 @@ import {
type EventFrame,
EventFrameSchema,
errorShape,
type GatewayFrame,
GatewayFrameSchema,
type Hello,
type HelloError,
HelloErrorSchema,
type HelloOk,
HelloOkSchema,
HelloSchema,
PROTOCOL_VERSION,
type PresenceEntry,
PresenceEntrySchema,
ProtocolSchemas,
PROTOCOL_VERSION,
type RequestFrame,
RequestFrameSchema,
type ResponseFrame,
ResponseFrameSchema,
SendParamsSchema,
type ShutdownEvent,
ShutdownEventSchema,
type Snapshot,
SnapshotSchema,
type StateVersion,
StateVersionSchema,
TickEventSchema,
type TickEvent,
GatewayFrameSchema,
type GatewayFrame,
type ShutdownEvent,
ShutdownEventSchema,
TickEventSchema,
} from "./schema.js";
const ajv = new (