From 63d0061afb26fa84d0d7aa5c4f4ea08da9cf357c Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 21 Aug 2014 20:43:33 +0900 Subject: [PATCH 1/5] modify method signature --- 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 282120dc6..be3813ade 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1110,7 +1110,7 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; + export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; From 0446dc4b625840653b894d10b4c9b0586709e167 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 21 Aug 2014 20:44:04 +0900 Subject: [PATCH 2/5] add optional variable --- passport/passport.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/passport/passport.d.ts b/passport/passport.d.ts index 6d03093eb..977323140 100644 --- a/passport/passport.d.ts +++ b/passport/passport.d.ts @@ -8,6 +8,7 @@ declare module Express { export interface Request { session?: any; + authInfo?: any; // These declarations are merged into express's Request type login(user: any, done: (err: any) => void): void; From aa8615f8f29ee2ea8cd7969a41718331667b1be8 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 21 Aug 2014 20:44:20 +0900 Subject: [PATCH 3/5] fix bug --- request/request-tests.ts | 3 ++- request/request.d.ts | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/request/request-tests.ts b/request/request-tests.ts index d422c3abc..986702c27 100644 --- a/request/request-tests.ts +++ b/request/request-tests.ts @@ -114,7 +114,8 @@ req = req.oauth(oauth); req = req.jar(jar); write = req.pipe(write); write = req.pipe(write, value); -req.write(); +req.pipe(req); +req.write(value); req.end(str); req.end(buffer); req.pause(); diff --git a/request/request.d.ts b/request/request.d.ts index e6a1d100e..5331fbd17 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -91,7 +91,7 @@ declare module 'request' { body: any; } - export interface Request { + export interface Request extends http.ClientRequest { getAgent(): http.Agent; //start(): void; //abort(): void; @@ -108,12 +108,8 @@ declare module 'request' { jar(jar: CookieJar): Request; pipe(dest: stream.Writable, opts?: any): stream.Writable; - write(): void; - end(chunk: string): void; - end(chunk: NodeBuffer): void; pause(): void; resume(): void; - abort(): void; destroy(): void; toJSON(): string; } From 19e6407072a93eea6adbe6548a575329b680ef38 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 21 Aug 2014 21:09:38 +0900 Subject: [PATCH 4/5] modify exnteds interface --- request/request.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/request/request.d.ts b/request/request.d.ts index 5331fbd17..b204920a8 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -91,7 +91,7 @@ declare module 'request' { body: any; } - export interface Request extends http.ClientRequest { + export interface Request extends stream.Writable { getAgent(): http.Agent; //start(): void; //abort(): void; @@ -110,6 +110,7 @@ declare module 'request' { pipe(dest: stream.Writable, opts?: any): stream.Writable; pause(): void; resume(): void; + abort(): void; destroy(): void; toJSON(): string; } From a38d60a3dd5d36a14f7d76f9d25f994b92595b77 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 22 Aug 2014 12:37:27 +0900 Subject: [PATCH 5/5] add stream.Stream type --- node/node.d.ts | 4 ++++ request/request.d.ts | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index be3813ade..4140a8c4b 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1121,6 +1121,10 @@ declare module "crypto" { declare module "stream" { import events = require("events"); + export interface Stream extends events.EventEmitter { + pipe(destination: T, options?: { end?: boolean; }): T; + } + export interface ReadableOptions { highWaterMark?: number; encoding?: string; diff --git a/request/request.d.ts b/request/request.d.ts index b204920a8..fc03a7e19 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -91,7 +91,10 @@ declare module 'request' { body: any; } - export interface Request extends stream.Writable { + export interface Request extends stream.Stream { + readable: boolean; + writable: boolean; + getAgent(): http.Agent; //start(): void; //abort(): void; @@ -107,7 +110,14 @@ declare module 'request' { oauth(oauth: OAuthOptions): Request; jar(jar: CookieJar): Request; - pipe(dest: stream.Writable, opts?: any): stream.Writable; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + end(): void; + end(chunk: Buffer, cb?: Function): void; + end(chunk: string, cb?: Function): void; + end(chunk: string, encoding: string, cb?: Function): void; pause(): void; resume(): void; abort(): void;