Skip to content

Commit

Permalink
fix: .on and .off types (#91)
Browse files Browse the repository at this point in the history
* Push

* Add changeset
  • Loading branch information
PuruVJ authored Aug 21, 2024
1 parent cbfe271 commit 5adb557
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-paws-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clockworklabs/spacetimedb-sdk': patch
---

types: Allow autocomplete in .on and .off types
10 changes: 8 additions & 2 deletions packages/sdk/src/spacetimedb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5adb557

Please sign in to comment.