diff --git a/types/ftpd/index.d.ts b/types/ftpd/index.d.ts index cd325109ee..8af363b572 100644 --- a/types/ftpd/index.d.ts +++ b/types/ftpd/index.d.ts @@ -75,7 +75,7 @@ export interface FtpServerOptions { /** * If this is set, the server will allow explicit TLS authentication. Value should be a dictionary which is suitable as the options argument of tls.createServer. */ - tlsOptions?: tls.TlsOptions; + tlsOptions?: tls.TlsServerOptions; /** * If this is set to true, and tlsOptions is also set, then the server will not allow logins over non-secure connections. * Default false diff --git a/types/http-proxy-middleware/index.d.ts b/types/http-proxy-middleware/index.d.ts index 5db24429c9..dd944d94e3 100644 --- a/types/http-proxy-middleware/index.d.ts +++ b/types/http-proxy-middleware/index.d.ts @@ -43,7 +43,7 @@ declare namespace proxy { target?: string; forward?: string; agent?: http.Agent; - ssl?: tls.TlsOptions; + ssl?: tls.TlsServerOptions; ws?: boolean; xfwd?: boolean; secure?: boolean; diff --git a/types/node/index.d.ts b/types/node/index.d.ts index ffe62a9355..d11096493f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -18,6 +18,7 @@ // Hannes Magnusson // Alberto Schiabel // Klaus Meinhardt +// Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -113,7 +114,7 @@ declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { -/* tslint:disable-next-line:callable-types */ + /* tslint:disable-next-line:callable-types */ (id: string): any; } @@ -1745,33 +1746,20 @@ declare module "https" { import * as http from "http"; import { URL } from "url"; - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error | null, ctx: tls.SecureContext) => void) => void; - secureProtocol?: string; - } + export type ServerOptions = tls.SecureContextOptions & tls.TlsServerOptions; - export interface RequestOptions extends http.RequestOptions { - pfx?: any; - key?: any; + export type RequestOptions = http.RequestOptions & { + rejectUnauthorized?: boolean; // Defaults to true + servername?: string; // SNI TLS Extension + pfx?: string | Buffer | Array; + key?: string | Buffer | Array; passphrase?: string; - cert?: any; - ca?: any; + cert?: string | Buffer | Array; + ca?: string | Buffer | Array; ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - servername?: string; - } + clientCertEngine?: string; + secureProtocol?: string; // SSL Method, e.g. SSLv23_method + }; export interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { rejectUnauthorized?: boolean; @@ -4844,7 +4832,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible NPN protocols. * (Protocols should be ordered by their priority.) */ - NPNProtocols?: string[] | Buffer, + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) When the server @@ -4852,7 +4840,7 @@ declare module "tls" { * precedence over NPN and the server does not send an NPN extension * to the client. */ - ALPNProtocols?: string[] | Buffer, + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -4928,7 +4916,7 @@ declare module "tls" { * @param callback - callback(err) will be executed with null as err, once the renegotiation * is successfully completed. */ - renegotiate(options: TlsOptions, callback: (err: Error | null) => void): any; + renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any; /** * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by @@ -4971,30 +4959,16 @@ declare module "tls" { prependOnceListener(event: "secureConnect", listener: () => void): this; } - export interface TlsOptions { - host?: string; - port?: number; - pfx?: string | Buffer[]; - key?: string | string[] | Buffer | any[]; - passphrase?: string; - cert?: string | string[] | Buffer | Buffer[]; - ca?: string | string[] | Buffer | Buffer[]; - crl?: string | string[]; - ciphers?: string; - honorCipherOrder?: boolean; + export interface TlsServerOptions extends SecureContextOptions { + clientCertEngine?: string; + handshakeTimeout?: number; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: string[] | Buffer; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - ecdhCurve?: string; - dhparam?: string | Buffer; - handshakeTimeout?: number; - ALPNProtocols?: string[] | Buffer; sessionTimeout?: number; ticketKeys?: Buffer; - sessionIdContext?: string; - secureProtocol?: string; - secureOptions?: number; } export interface ConnectionOptions extends SecureContextOptions { @@ -5003,8 +4977,8 @@ declare module "tls" { path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket rejectUnauthorized?: boolean; // Defaults to true - NPNProtocols?: Array; - ALPNProtocols?: Array; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; checkServerIdentity?: typeof checkServerIdentity; servername?: string; // SNI TLS Extension session?: Buffer; @@ -5102,6 +5076,7 @@ declare module "tls" { ciphers?: string; honorCipherOrder?: boolean; ecdhCurve?: string; + clientCertEngine?: string; crl?: string | Buffer | Array; dhparam?: string | Buffer; secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options @@ -5121,7 +5096,7 @@ declare module "tls" { * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. */ export function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; - export function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; + export function createServer(options: TlsServerOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; export function connect(options: ConnectionOptions, secureConnectionListener?: () => void): TLSSocket; export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; @@ -5405,7 +5380,7 @@ declare module "stream" { readonly writableLength: number; constructor(opts?: WritableOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5498,7 +5473,7 @@ declare module "stream" { readonly writableLength: number; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5578,9 +5553,9 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; @@ -6173,7 +6148,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void|boolean; + statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; getTrailers?: (trailers: OutgoingHttpHeaders) => void; offset?: number; length?: number; @@ -6519,7 +6494,7 @@ declare module "http2" { export type ServerSessionOptions = SessionOptions; export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } + export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsServerOptions { } export interface ServerOptions extends ServerSessionOptions { allowHTTP1?: boolean; diff --git a/types/node/tsconfig.json b/types/node/tsconfig.json index 16836a1483..44d72e800a 100644 --- a/types/node/tsconfig.json +++ b/types/node/tsconfig.json @@ -22,4 +22,4 @@ "forceConsistentCasingInFileNames": true, "esModuleInterop": true } -} \ No newline at end of file +} diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 7c7c6ff615..39c7dcbe26 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -17,7 +17,9 @@ // Sebastian Silbermann // Hannes Magnusson // Alberto Schiabel +// Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /** inspector module types */ /// @@ -111,7 +113,7 @@ declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { -/* tslint:disable-next-line:callable-types */ + /* tslint:disable-next-line:callable-types */ (id: string): any; } @@ -1733,33 +1735,20 @@ declare module "https" { import * as http from "http"; import { URL } from "url"; - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error | null, ctx: tls.SecureContext) => void) => void; - secureProtocol?: string; - } + export type ServerOptions = tls.SecureContextOptions & tls.TlsServerOptions; - export interface RequestOptions extends http.RequestOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - servername?: string; - } + // see https://nodejs.org/docs/latest-v8.x/api/https.html#https_https_request_options_callback + type extendedRequestKeys = "pfx" | + "key" | + "passphrase" | + "cert" | + "ca" | + "ciphers" | + "rejectUnauthorized" | + "secureProtocol" | + "servername"; + + export type RequestOptions = http.RequestOptions & Pick; export interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { rejectUnauthorized?: boolean; @@ -4821,7 +4810,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible NPN protocols. * (Protocols should be ordered by their priority.) */ - NPNProtocols?: string[] | Buffer, + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) When the server @@ -4829,7 +4818,7 @@ declare module "tls" { * precedence over NPN and the server does not send an NPN extension * to the client. */ - ALPNProtocols?: string[] | Buffer, + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -4905,7 +4894,7 @@ declare module "tls" { * @param callback - callback(err) will be executed with null as err, once the renegotiation * is successfully completed. */ - renegotiate(options: TlsOptions, callback: (err: Error | null) => void): any; + renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any; /** * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by @@ -4948,30 +4937,15 @@ declare module "tls" { prependOnceListener(event: "secureConnect", listener: () => void): this; } - export interface TlsOptions { - host?: string; - port?: number; - pfx?: string | Buffer[]; - key?: string | string[] | Buffer | any[]; - passphrase?: string; - cert?: string | string[] | Buffer | Buffer[]; - ca?: string | string[] | Buffer | Buffer[]; - crl?: string | string[]; - ciphers?: string; - honorCipherOrder?: boolean; + export interface TlsServerOptions extends SecureContextOptions { + handshakeTimeout?: number; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: string[] | Buffer; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - ecdhCurve?: string; - dhparam?: string | Buffer; - handshakeTimeout?: number; - ALPNProtocols?: string[] | Buffer; sessionTimeout?: number; ticketKeys?: Buffer; - sessionIdContext?: string; - secureProtocol?: string; - secureOptions?: number; } export interface ConnectionOptions extends SecureContextOptions { @@ -4980,8 +4954,8 @@ declare module "tls" { path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket rejectUnauthorized?: boolean; // Defaults to true - NPNProtocols?: Array; - ALPNProtocols?: Array; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; checkServerIdentity?: typeof checkServerIdentity; servername?: string; // SNI TLS Extension session?: Buffer; @@ -5098,7 +5072,7 @@ declare module "tls" { * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. */ export function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; - export function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; + export function createServer(options: TlsServerOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; export function connect(options: ConnectionOptions, secureConnectionListener?: () => void): TLSSocket; export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; @@ -5378,7 +5352,7 @@ declare module "stream" { writable: boolean; constructor(opts?: WritableOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5469,7 +5443,7 @@ declare module "stream" { writable: boolean; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5549,9 +5523,9 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; @@ -6146,7 +6120,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void|boolean; + statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; getTrailers?: (trailers: OutgoingHttpHeaders) => void; offset?: number; length?: number; @@ -6492,7 +6466,7 @@ declare module "http2" { export type ServerSessionOptions = SessionOptions; export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } + export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsServerOptions { } export interface ServerOptions extends ServerSessionOptions { allowHTTP1?: boolean; diff --git a/types/nodemailer/lib/fetch/index.d.ts b/types/nodemailer/lib/fetch/index.d.ts index 8fc814c517..d0006cd4b7 100644 --- a/types/nodemailer/lib/fetch/index.d.ts +++ b/types/nodemailer/lib/fetch/index.d.ts @@ -21,7 +21,7 @@ declare namespace fetch { userAgent?: string; body?: Buffer | string | { [key: string]: string }; contentType?: string | false; - tls?: tls.TlsOptions; + tls?: tls.TlsServerOptions; timeout?: ms; allowErrorResponse?: boolean; } diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 9f945082cd..f91402efe1 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -26,21 +26,21 @@ export interface Defaults extends ConnectionConfig { parseInt8?: boolean; } -import { TlsOptions } from "tls"; +import { TlsServerOptions } from "tls"; export interface ClientConfig extends ConnectionConfig { - ssl?: boolean | TlsOptions; + ssl?: boolean | TlsServerOptions; } export interface PoolConfig extends ClientConfig { - // properties from module 'node-pool' - max?: number; - min?: number; - connectionTimeoutMillis?: number; - idleTimeoutMillis?: number; + // properties from module 'node-pool' + max?: number; + min?: number; + connectionTimeoutMillis?: number; + idleTimeoutMillis?: number; - application_name?: string; - Promise?: PromiseConstructorLike; + application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { diff --git a/types/pg/v6/index.d.ts b/types/pg/v6/index.d.ts index 5624989ac7..48ae20133c 100644 --- a/types/pg/v6/index.d.ts +++ b/types/pg/v6/index.d.ts @@ -29,22 +29,22 @@ export interface Defaults extends ConnectionConfig { parseInt8?: boolean; } -import { TlsOptions } from "tls"; +import { TlsServerOptions } from "tls"; export interface ClientConfig extends ConnectionConfig { - ssl?: boolean | TlsOptions; + ssl?: boolean | TlsServerOptions; } export interface PoolConfig extends ClientConfig { - // properties from module 'node-pool' - max?: number; - min?: number; - refreshIdle?: boolean; - idleTimeoutMillis?: number; - reapIntervalMillis?: number; - returnToHead?: boolean; - application_name?: string; - Promise?: PromiseConstructorLike; + // properties from module 'node-pool' + max?: number; + min?: number; + refreshIdle?: boolean; + idleTimeoutMillis?: number; + reapIntervalMillis?: number; + returnToHead?: boolean; + application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { diff --git a/types/smtp-server/index.d.ts b/types/smtp-server/index.d.ts index 6e71373260..c00faf431a 100644 --- a/types/smtp-server/index.d.ts +++ b/types/smtp-server/index.d.ts @@ -93,7 +93,7 @@ export interface SMTPServerSession { envelope: SMTPServerEnvelope; transmissionType: string; - tlsOptions: tls.TlsOptions; + tlsOptions: tls.TlsServerOptions; } export interface SMTPServerEnvelope { @@ -107,7 +107,7 @@ export interface SMTPServerEnvelope { rcptTo: SMTPServerAddress[]; } -export interface SMTPServerOptions extends tls.TlsOptions { +export interface SMTPServerOptions extends tls.TlsServerOptions { /** * if true, the connection will use TLS. The default is false. * If the server doesn't start in TLS mode, @@ -188,7 +188,7 @@ export interface SMTPServerOptions extends tls.TlsOptions { /** * optional Map or an object of TLS options for SNI where servername is the key. Overrided by SNICallback. */ - sniOptions?: { [servername: string]: tls.TlsOptions } | Map; + sniOptions?: { [servername: string]: tls.TlsServerOptions } | Map; /** * optional boolean, if set to true then upgrade sockets to TLS immediately after connection is established. Works with secure: true */ @@ -282,7 +282,7 @@ export class SMTPServer extends EventEmitter { /** Closes the server */ close(callback: (err?: Error | null) => void): void; - updateSecureContext(options: tls.TlsOptions): void; + updateSecureContext(options: tls.TlsServerOptions): void; /** Authentication handler. Override this */ onAuth(auth: SMTPServerAuthentication, session: SMTPServerSession, callback: (err: Error | null | undefined, response: SMTPServerAuthenticationResponse) => void): void; diff --git a/types/smtp-server/smtp-server-tests.ts b/types/smtp-server/smtp-server-tests.ts index 29c05c942e..5be0634ebb 100644 --- a/types/smtp-server/smtp-server-tests.ts +++ b/types/smtp-server/smtp-server-tests.ts @@ -8,9 +8,10 @@ const options: SMTPServerOptions = { onRcptTo, onData, onClose, - port: 2525 }; +const port = 2525; + function onConnect(session: SMTPServerSession, callback: (err?: Error) => void): void { console.log(`[${session.id}] onConnect`); callback(); @@ -69,7 +70,7 @@ server.on('close', () => { console.log('Server closed'); }); -server.listen(options.port, () => { +server.listen(port, () => { const address = server.server.address(); console.log(`Listening on [${address.address}]:${address.port}`); }); diff --git a/types/thrift/index.d.ts b/types/thrift/index.d.ts index c5cb6f20a3..3905b40bfa 100644 --- a/types/thrift/index.d.ts +++ b/types/thrift/index.d.ts @@ -227,7 +227,7 @@ export interface ServiceMap { export interface ServiceOptions { transport?: TTransportConstructor; protocol?: TProtocolConstructor; - processor?: { new (handler: THandler): TProcessor }; + processor?: { new(handler: THandler): TProcessor }; handler?: THandler; } @@ -236,7 +236,7 @@ export interface ServerOptions extends ServiceOptions; - tls?: tls.TlsOptions; + tls?: tls.TlsServerOptions; } export interface ConnectOptions { @@ -263,12 +263,12 @@ export interface WSConnectOptions { } export type TClientConstructor = - { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } | - { Client: { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } }; + { new(output: TTransport, pClass: { new(trans: TTransport): TProtocol }): TClient; } | + { Client: { new(output: TTransport, pClass: { new(trans: TTransport): TProtocol }): TClient; } }; export type TProcessorConstructor = - { new (handler: THandler): TProcessor } | - { Processor: { new (handler: THandler): TProcessor }}; + { new(handler: THandler): TProcessor } | + { Processor: { new(handler: THandler): TProcessor } }; export interface WebServerOptions { services: { @@ -361,7 +361,7 @@ export class TFramedTransport implements TTransport { } export interface TTransportConstructor { - new (buffer?: Buffer, callback?: TTransportCallback): TTransport; + new(buffer?: Buffer, callback?: TTransportCallback): TTransport; } export class TBinaryProtocol implements TProtocol { @@ -509,7 +509,7 @@ export class TCompactProtocol implements TProtocol { } export interface TProtocolConstructor { - new (trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; + new(trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; } // thrift.js diff --git a/types/xmlrpc/index.d.ts b/types/xmlrpc/index.d.ts index 8425d4672c..7cc76d9511 100644 --- a/types/xmlrpc/index.d.ts +++ b/types/xmlrpc/index.d.ts @@ -9,7 +9,7 @@ declare module 'xmlrpc' { import { EventEmitter } from 'events'; import { Server as HttpServer } from 'http'; import { Server as HttpsServer } from 'https'; - import { TlsOptions } from 'tls'; + import { TlsServerOptions } from 'tls'; interface ClientOptions { host?: string; @@ -47,7 +47,7 @@ declare module 'xmlrpc' { function createSecureClient(options: string | ClientOptions): Client; function createServer(options: string | ServerOptions, callback: () => void): Server; - function createSecureServer(options: string | TlsOptions, callback: () => void): Server; + function createSecureServer(options: string | TlsServerOptions, callback: () => void): Server; interface Client { options: ClientOptions;