diff --git a/.changeset/beige-paws-repair.md b/.changeset/beige-paws-repair.md new file mode 100644 index 0000000..361a8a7 --- /dev/null +++ b/.changeset/beige-paws-repair.md @@ -0,0 +1,5 @@ +--- +'@clockworklabs/spacetimedb-sdk': patch +--- + +types: Allow autocomplete in .on and .off types diff --git a/packages/sdk/src/spacetimedb.ts b/packages/sdk/src/spacetimedb.ts index 91c0d9e..d391733 100644 --- a/packages/sdk/src/spacetimedb.ts +++ b/packages/sdk/src/spacetimedb.ts @@ -682,11 +682,17 @@ export class SpacetimeDBClient { this.#sendMessage(message); } - on(eventName: EventType | string, callback: (...args: any[]) => void): void { + on( + eventName: EventType | (string & {}), + callback: (...args: any[]) => void + ): void { this.emitter.on(eventName, callback); } - off(eventName: EventType | string, callback: (...args: any[]) => void): void { + off( + eventName: EventType | (string & {}), + callback: (...args: any[]) => void + ): void { this.emitter.off(eventName, callback); }