mirror of
https://github.com/thelounge/thelounge
synced 2024-11-24 21:13:06 +00:00
client: properly type the emit method
This breaks the world -.-
This commit is contained in:
parent
bf7eb0e727
commit
35e38d13c4
1 changed files with 6 additions and 2 deletions
|
@ -24,6 +24,7 @@ import {StorageCleaner} from "./storageCleaner";
|
|||
import {SearchQuery, SearchResponse} from "../shared/types/storage";
|
||||
import {SharedChan, ChanType} from "../shared/types/chan";
|
||||
import {SharedNetwork} from "../shared/types/network";
|
||||
import {ServerToClientEvents} from "../shared/types/socket-events";
|
||||
|
||||
const events = [
|
||||
"away",
|
||||
|
@ -222,9 +223,12 @@ class Client {
|
|||
return chan;
|
||||
}
|
||||
|
||||
emit(event: string, data?: any) {
|
||||
emit<Ev extends keyof ServerToClientEvents>(
|
||||
event: Ev,
|
||||
...args: Parameters<ServerToClientEvents[Ev]>
|
||||
) {
|
||||
if (this.manager !== null) {
|
||||
this.manager.sockets.in(this.id).emit(event, data);
|
||||
this.manager.sockets.in(this.id).emit(event, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue