mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-24 11:50:59 +08:00
node: improved EventEmitter's definition with this-typing
This commit is contained in:
1 parent
dade441471
commit
abc2bcfb85
28 files changed
+321
-359
No files matched your search
Vendored
+5
-5
@@ -24,8 +24,8 @@ declare module "sockjs" {
|
||||
export interface Server extends NodeJS.EventEmitter {
|
||||
installHandlers(server: http.Server, options?: ServerOptions): any;
|
||||
|
||||
on(event: 'connection', listener: (conn: Connection) => any): Server;
|
||||
on(event: string, listener: Function): Server;
|
||||
on(event: 'connection', listener: (conn: Connection) => any): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
|
||||
export interface Connection extends NodeJS.ReadWriteStream {
|
||||
@@ -50,8 +50,8 @@ declare module "sockjs" {
|
||||
close(code?: string, reason?: string): boolean;
|
||||
destroy(): void;
|
||||
|
||||
on(event: 'data', listener: (message: string) => any): Connection;
|
||||
on(event: 'close', listener: () => void): Connection;
|
||||
on(event: string, listener: Function): Connection;
|
||||
on(event: 'data', listener: (message: string) => any): this;
|
||||
on(event: 'close', listener: () => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user