node: improved EventEmitter's definition with this-typing

This commit is contained in:
Ilya Mochalov
2016-02-25 02:10:08 +05:00
parent dade441471
commit abc2bcfb85
28 changed files with 321 additions and 359 deletions
+5 -5
View File
@@ -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;
}
}