-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typings): properly type server-side events
See also: 93cce05
- Loading branch information
1 parent
fb6b0ef
commit b84ed1e
Showing
5 changed files
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ export const RESERVED_EVENTS: ReadonlySet<string | Symbol> = new Set< | |
export class Namespace< | ||
ListenEvents extends EventsMap = DefaultEventsMap, | ||
EmitEvents extends EventsMap = ListenEvents, | ||
ServerSideEvents extends EventsMap = {} | ||
ServerSideEvents extends EventsMap = DefaultEventsMap | ||
> extends StrictEventEmitter< | ||
ServerSideEvents, | ||
EmitEvents, | ||
|
@@ -306,9 +306,8 @@ export class Namespace< | |
* | ||
* @private | ||
*/ | ||
_onServerSideEmit(args: any[]) { | ||
const event = args.shift(); | ||
this.emitUntyped(event, args); | ||
_onServerSideEmit(args: [eventName: string, ...args: any[]]) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
MaximeKjaer
Contributor
|
||
super.emitUntyped.apply(this, args); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shouldn't this be
args: [string, ...any[]]
? As far as i'm aware you're unable to define properties names as an individual element in an array.This may cause issues for people compiling this dependency with certain typescript versions.