From aebd7dec12bbe71ba544d2673fb6ed1868c4cecd Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Wed, 25 Feb 2015 07:57:03 +0900 Subject: [PATCH 1/3] Fix many incorrect types of socket.io.d.ts. references: https://github.com/Automattic/socket.io --- socket.io/socket.io.d.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 2571e239b..3a37d819a 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -37,19 +37,19 @@ declare module SocketIO { emit(name: string, ...args: any[]): Socket; use(fn: Function): Namespace; - on(event: 'connection', listener: (socket: Socket) => void): any; - on(event: 'connect', listener: (socket: Socket) => void): any; - on(event: string, listener: Function): any; + on(event: 'connection', listener: (socket: Socket) => void): Namespace; + on(event: 'connect', listener: (socket: Socket) => void): Namespace; + on(event: string, listener: Function): Namespace; } interface Namespace extends NodeJS.EventEmitter { name: string; connected: { [id: string]: Socket }; - use(fn: Function): Namespace + use(fn: Function): Namespace; - on(event: 'connection', listener: (socket: Socket) => void): any; - on(event: 'connect', listener: (socket: Socket) => void): any; - on(event: string, listener: Function): any; + on(event: 'connection', listener: (socket: Socket) => void): Namespace; + on(event: 'connect', listener: (socket: Socket) => void): Namespace; + on(event: string, listener: Function): Namespace; } interface Socket { @@ -63,8 +63,13 @@ declare module SocketIO { leave(name: string, fn?: Function): Socket; to(room: string): Socket; in(room: string): Socket; + send(): Socket; + write(): Socket; - on(event: string, listener: Function): any; + on(event: string, listener: Function): Socket; + once(event: string, listener: Function): Socket; + removeListener(event: string, listener: Function): Socket; + removeAllListeners(event: string): Socket; broadcast: Socket; volatile: Socket; connected: boolean; From 24991f93983dcd7b9004001583b74978114e3afd Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Wed, 25 Feb 2015 10:05:33 +0900 Subject: [PATCH 2/3] Fix socket.io.d.ts: argument of send(), write() oops --- socket.io/socket.io.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 3a37d819a..677d4fcc2 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -63,8 +63,8 @@ declare module SocketIO { leave(name: string, fn?: Function): Socket; to(room: string): Socket; in(room: string): Socket; - send(): Socket; - write(): Socket; + send(...args: any[]): Socket; + write(...args: any[]): Socket; on(event: string, listener: Function): Socket; once(event: string, listener: Function): Socket; From 819aa8bc552c8aacf526ebf6aa4b2d3a70084688 Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Sat, 28 Feb 2015 09:34:04 +0900 Subject: [PATCH 3/3] node.d.ts: child_process#send() 2nd argument is optional --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index b1e849535..c30b2a9b4 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -609,7 +609,7 @@ declare module "child_process" { stderr: stream.Readable; pid: number; kill(signal?: string): void; - send(message: any, sendHandle: any): void; + send(message: any, sendHandle?: any): void; disconnect(): void; }