diff --git a/types/node/http.d.ts b/types/node/http.d.ts index 49ef45b1b3..ef5f1efccf 100644 --- a/types/node/http.d.ts +++ b/types/node/http.d.ts @@ -277,7 +277,7 @@ declare module "http" { rawHeaders: string[]; trailers: { [key: string]: string | undefined }; rawTrailers: string[]; - setTimeout(msecs: number, callback: () => void): this; + setTimeout(msecs: number, callback?: () => void): this; /** * Only valid for request obtained from http.Server. */ diff --git a/types/node/index.d.ts b/types/node/index.d.ts index e04485bfcb..3f72549836 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -38,6 +38,7 @@ // Thanik Bhongbhibhat // Marcin Kopacz // Trivikram Kamat +// Minh Son Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // NOTE: These definitions support NodeJS and TypeScript 3.2. diff --git a/types/node/test/http.ts b/types/node/test/http.ts index 014142fdb1..e0147fda60 100644 --- a/types/node/test/http.ts +++ b/types/node/test/http.ts @@ -43,6 +43,7 @@ import * as net from 'net'; const incoming: http.IncomingMessage = new http.IncomingMessage(new net.Socket()); incoming.setEncoding('utf8'); + incoming.setTimeout(1000).setTimeout(100, () => {}); // stream incoming.pause(); diff --git a/types/node/v10/http.d.ts b/types/node/v10/http.d.ts index cb764e45d8..db4a3c399f 100644 --- a/types/node/v10/http.d.ts +++ b/types/node/v10/http.d.ts @@ -184,7 +184,7 @@ declare module "http" { rawHeaders: string[]; trailers: { [key: string]: string | undefined }; rawTrailers: string[]; - setTimeout(msecs: number, callback: () => void): this; + setTimeout(msecs: number, callback?: () => void): this; /** * Only valid for request obtained from http.Server. */ diff --git a/types/node/v10/index.d.ts b/types/node/v10/index.d.ts index 8e650d7492..58053aaa66 100644 --- a/types/node/v10/index.d.ts +++ b/types/node/v10/index.d.ts @@ -35,6 +35,7 @@ // Kyle Uehlein // Jordi Oliveras Rovira // Thanik Bhongbhibhat +// Minh Son Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // NOTE: These definitions support NodeJS and TypeScript 3.1. diff --git a/types/node/v11/http.d.ts b/types/node/v11/http.d.ts index 31175d76b6..da9f88d8ae 100644 --- a/types/node/v11/http.d.ts +++ b/types/node/v11/http.d.ts @@ -186,7 +186,7 @@ declare module "http" { rawHeaders: string[]; trailers: { [key: string]: string | undefined }; rawTrailers: string[]; - setTimeout(msecs: number, callback: () => void): this; + setTimeout(msecs: number, callback?: () => void): this; /** * Only valid for request obtained from http.Server. */ diff --git a/types/node/v11/index.d.ts b/types/node/v11/index.d.ts index 9a616b179c..f6cbf06e2e 100644 --- a/types/node/v11/index.d.ts +++ b/types/node/v11/index.d.ts @@ -38,6 +38,7 @@ // Jordi Oliveras Rovira // Thanik Bhongbhibhat // Ivan Sieder +// Minh Son Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // NOTE: These definitions support NodeJS and TypeScript 3.2.