diff --git a/types/node/assert.d.ts b/types/node/assert.d.ts index dd662a1306..df6df63fc0 100644 --- a/types/node/assert.d.ts +++ b/types/node/assert.d.ts @@ -43,6 +43,9 @@ declare module "assert" { function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; function doesNotReject(block: (() => Promise) | Promise, error: RegExp | Function, message?: string | Error): Promise; + function match(value: string, regExp: RegExp, message?: string | Error): void; + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; + const strict: typeof internal; } diff --git a/types/node/events.d.ts b/types/node/events.d.ts index 0951d1c4a9..b07defc086 100644 --- a/types/node/events.d.ts +++ b/types/node/events.d.ts @@ -1,6 +1,10 @@ declare module "events" { - interface internal extends NodeJS.EventEmitter {} - class internal { } + interface EventEmitterOptions { + /** + * Enables automatic capturing of promise rejection. + */ + captureRejections?: boolean; + } interface NodeEventTarget { once(event: string | symbol, listener: (...args: any[]) => void): this; @@ -10,31 +14,37 @@ declare module "events" { addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any; } - namespace internal { + namespace EventEmitter { function once(emitter: NodeEventTarget, event: string | symbol): Promise; function once(emitter: DOMEventTarget, event: string): Promise; - class EventEmitter extends internal { + function on(emitter: EventEmitter, event: string): AsyncIterableIterator; + const captureRejectionSymbol: unique symbol; + + /** + * This symbol shall be used to install a listener for only monitoring `'error'` + * events. Listeners installed using this symbol are called before the regular + * `'error'` listeners are called. + * + * Installing a listener using this symbol does not change the behavior once an + * `'error'` event is emitted, therefore the process will still crash if no + * regular `'error'` listener is installed. + */ + const errorMonitor: unique symbol; + /** + * Sets or gets the default captureRejection value for all emitters. + */ + let captureRejections: boolean; + + interface EventEmitter extends NodeJS.EventEmitter { + } + + class EventEmitter { + constructor(options?: EventEmitterOptions); /** @deprecated since v4.0.0 */ static listenerCount(emitter: EventEmitter, event: string | symbol): number; static defaultMaxListeners: number; - - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string | symbol): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; - rawListeners(event: string | symbol): Function[]; - emit(event: string | symbol, ...args: any[]): boolean; - eventNames(): Array; - listenerCount(type: string | symbol): number; } } - export = internal; + export = EventEmitter; } diff --git a/types/node/fs.d.ts b/types/node/fs.d.ts index c7b3ef135d..c5ad15a149 100644 --- a/types/node/fs.d.ts +++ b/types/node/fs.d.ts @@ -745,21 +745,20 @@ declare module "fs" { interface RmDirAsyncOptions extends RmDirOptions { /** - * If an `EMFILE` error is encountered, Node.js will - * retry the operation with a linear backoff of 1ms longer on each try until the - * timeout duration passes this limit. This option is ignored if the `recursive` - * option is not `true`. - * @default 1000 + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 */ - emfileWait?: number; + retryDelay?: number; /** - * If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is - * encountered, Node.js will retry the operation with a linear backoff wait of - * 100ms longer on each try. This option represents the number of retries. This - * option is ignored if the `recursive` option is not `true`. - * @default 3 + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 */ - maxBusyTries?: number; + maxRetries?: number; } /** diff --git a/types/node/http.d.ts b/types/node/http.d.ts index a82fd0e57b..f6bc57ee1c 100644 --- a/types/node/http.d.ts +++ b/types/node/http.d.ts @@ -77,6 +77,10 @@ declare module "http" { defaultPort?: number | string; localAddress?: string; socketPath?: string; + /** + * @default 8192 + */ + maxHeaderSize?: number; method?: string; path?: string | null; headers?: OutgoingHttpHeaders; @@ -92,14 +96,18 @@ declare module "http" { interface ServerOptions { IncomingMessage?: typeof IncomingMessage; ServerResponse?: typeof ServerResponse; + /** + * Optionally overrides the value of + * [`--max-http-header-size`][] for requests received by this server, i.e. + * the maximum length of request headers in bytes. + * @default 8192 + */ + maxHeaderSize?: number; } type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; - class Server extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - + interface HttpBase { setTimeout(msecs?: number, callback?: () => void): this; setTimeout(callback: () => void): this; /** @@ -111,13 +119,19 @@ declare module "http" { timeout: number; /** * Limit the amount of time the parser will wait to receive the complete HTTP headers. - * @default 40000 + * @default 60000 * {@link https://nodejs.org/api/http.html#http_server_headerstimeout} */ headersTimeout: number; keepAliveTimeout: number; } + interface Server extends HttpBase {} + class Server extends NetServer { + constructor(requestListener?: RequestListener); + constructor(options: ServerOptions, requestListener?: RequestListener); + } + // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js class OutgoingMessage extends stream.Writable { upgrading: boolean; @@ -125,6 +139,9 @@ declare module "http" { shouldKeepAlive: boolean; useChunkedEncodingByDefault: boolean; sendDate: boolean; + /** + * @deprecated Use `writableEnded` instead. + */ finished: boolean; headersSent: boolean; /** @@ -150,7 +167,6 @@ declare module "http" { class ServerResponse extends OutgoingMessage { statusCode: number; statusMessage: string; - writableFinished: boolean; constructor(req: IncomingMessage); diff --git a/types/node/https.d.ts b/types/node/https.d.ts index 6f33dbd04f..24326c9d1f 100644 --- a/types/node/https.d.ts +++ b/types/node/https.d.ts @@ -21,26 +21,10 @@ declare module "https" { options: AgentOptions; } + interface Server extends http.HttpBase {} class Server extends tls.Server { constructor(requestListener?: http.RequestListener); constructor(options: ServerOptions, requestListener?: http.RequestListener); - - setTimeout(callback: () => void): this; - setTimeout(msecs?: number, callback?: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @default 2000 - * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount} - */ - maxHeadersCount: number | null; - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP headers. - * @default 40000 - * {@link https://nodejs.org/api/http.html#http_server_headerstimeout} - */ - headersTimeout: number; - keepAliveTimeout: number; } function createServer(requestListener?: http.RequestListener): Server; diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 452b842d8b..78af71a935 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Node.js 13.1 +// Type definitions for non-npm package Node.js 13.5 // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -43,16 +43,16 @@ // Ilia Baryshnikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// NOTE: These definitions support NodeJS and TypeScript 3.2. +// NOTE: These definitions support NodeJS and TypeScript 3.5. // NOTE: TypeScript version-specific augmentations can be found in the following paths: // - ~/base.d.ts - Shared definitions common to all TypeScript versions // - ~/index.d.ts - Definitions specific to TypeScript 2.8 -// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 +// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 -// NOTE: Augmentations for TypeScript 3.2 and later should use individual files for overrides -// within the respective ~/ts3.2 (or later) folder. However, this is disallowed for versions -// prior to TypeScript 3.2, so the older definitions will be found here. +// NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides +// within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions +// prior to TypeScript 3.5, so the older definitions will be found here. // Base definitions for all NodeJS modules that are not specific to any version of TypeScript: /// diff --git a/types/node/package.json b/types/node/package.json index cda6cc6dc8..924c4d658e 100644 --- a/types/node/package.json +++ b/types/node/package.json @@ -2,9 +2,9 @@ "private": true, "types": "index", "typesVersions": { - ">=3.2.0-0": { + ">=3.5.0-0": { "*": [ - "ts3.2/*" + "ts3.5/*" ] } } diff --git a/types/node/readline.d.ts b/types/node/readline.d.ts index 861606986f..751c5cf74c 100644 --- a/types/node/readline.d.ts +++ b/types/node/readline.d.ts @@ -47,6 +47,13 @@ declare module "readline" { close(): void; write(data: string | Buffer, key?: Key): void; + /** + * Returns the real position of the cursor in relation to the input + * prompt + string. Long input (wrapping) strings, as well as multiple + * line prompts are included in the calculations. + */ + getCursorPos(): CursorPos; + /** * events.EventEmitter * 1. close @@ -138,6 +145,11 @@ declare module "readline" { type Direction = -1 | 0 | 1; + interface CursorPos { + rows: number; + cols: number; + } + /** * Clears the current line of this WriteStream in a direction identified by `dir`. */ diff --git a/types/node/repl.d.ts b/types/node/repl.d.ts index a22df6560b..5e321d2718 100644 --- a/types/node/repl.d.ts +++ b/types/node/repl.d.ts @@ -36,6 +36,11 @@ declare module "repl" { * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions */ eval?: REPLEval; + /** + * Defines if the repl prints output previews or not. + * @default `true` Always `false` in case `terminal` is falsy. + */ + preview?: boolean; /** * If `true`, specifies that the default `writer` function should include ANSI color * styling to REPL output. If a custom `writer` function is provided then this has no diff --git a/types/node/stream.d.ts b/types/node/stream.d.ts index 17afed5cba..e82e1857da 100644 --- a/types/node/stream.d.ts +++ b/types/node/stream.d.ts @@ -6,7 +6,9 @@ declare module "stream" { } namespace internal { - class Stream extends internal { } + class Stream extends internal { + constructor(opts?: ReadableOptions); + } interface ReadableOptions { highWaterMark?: number; diff --git a/types/node/test/assert.ts b/types/node/test/assert.ts index 2184d06946..40dbd47783 100644 --- a/types/node/test/assert.ts +++ b/types/node/test/assert.ts @@ -13,12 +13,6 @@ assert.doesNotThrow(() => { assert.equal(3, "3", "uses == comparator"); -assert.fail('stuff broke'); - -assert.fail('actual', 'expected', 'message'); - -assert.fail(1, 2, undefined, '>'); - assert.ifError(0); assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses !== comparator"); @@ -42,3 +36,12 @@ assert.doesNotReject(async () => 1); assert.doesNotReject(Promise.resolve(1)); assert.strict.strict.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]); + +assert.match('test', /test/, new Error('yeet')); +assert.match('test', /test/, 'yeet'); + +assert.fail('stuff broke'); + +assert.fail('actual', 'expected', 'message'); + +assert.fail(1, 2, undefined, '>'); diff --git a/types/node/test/events.ts b/types/node/test/events.ts index 3278c2d659..621dd68067 100644 --- a/types/node/test/events.ts +++ b/types/node/test/events.ts @@ -78,3 +78,9 @@ const any: any = 1; } }, 'name'); } + +async function test() { + for await (const e of events.on(new events.EventEmitter(), 'test')) { + console.log(e); + } +} diff --git a/types/node/test/fs.ts b/types/node/test/fs.ts index 3d9faaa0e1..8fac4f3749 100644 --- a/types/node/test/fs.ts +++ b/types/node/test/fs.ts @@ -305,7 +305,7 @@ async function testPromisify() { (async () => { try { await fs.promises.rmdir('some/test/path'); - await fs.promises.rmdir('some/test/path', { recursive: true }); + await fs.promises.rmdir('some/test/path', { recursive: true, maxRetries: 123, retryDelay: 123 }); } catch (e) {} })(); diff --git a/types/node/test/readline.ts b/types/node/test/readline.ts index 664b6b7de2..d6ccd9ee22 100644 --- a/types/node/test/readline.ts +++ b/types/node/test/readline.ts @@ -198,3 +198,10 @@ const rl: readline.ReadLine = readline.createInterface(new stream.Readable()); // } }); } + +{ + const rl = readline.createInterface({ + input: process.stdin, + }); + const pos: readline.CursorPos = rl.getCursorPos(); +} diff --git a/types/node/test/repl.ts b/types/node/test/repl.ts index b536cd4dc1..4b2e81b07c 100644 --- a/types/node/test/repl.ts +++ b/types/node/test/repl.ts @@ -2,7 +2,9 @@ import { start, Recoverable } from "repl"; import { Context } from "vm"; { - let server = start(); + let server = start({ + preview: true, + }); let _boolean: boolean; const _ctx: Context = {}; diff --git a/types/node/test/tls.ts b/types/node/test/tls.ts index d37956c7f2..ff9913248b 100644 --- a/types/node/test/tls.ts +++ b/types/node/test/tls.ts @@ -24,7 +24,16 @@ import * as fs from "fs"; const connOpts: ConnectionOptions = { host: "127.0.0.1", - port: 55 + port: 55, + pskCallback(hint) { + if (hint === 'something??') { + return null; + } + return { + identitty: 'henlo', + psk: Buffer.from('asd'), + }; + }, }; const tlsSocket = connect(connOpts); @@ -53,6 +62,12 @@ import * as fs from "fs"; { const _server = createServer({ enableTrace: true, + pskCallback(socket, ident) { + if (ident === 'something') { + return null; + } + return Buffer.from('asdasd'); + } }); _server.addContext("example", { diff --git a/types/node/test/util.ts b/types/node/test/util.ts index d2fb1a6b11..92965245d2 100644 --- a/types/node/test/util.ts +++ b/types/node/test/util.ts @@ -39,6 +39,10 @@ import { readFile } from 'fs'; colors: true, }; + util.inspect({ + [util.inspect.custom]: ((depth, opts) => opts.stylize('woop', 'module')), + }); + util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); // util.callbackify diff --git a/types/node/test/worker_threads.ts b/types/node/test/worker_threads.ts index a9071787d7..2066ffbce8 100644 --- a/types/node/test/worker_threads.ts +++ b/types/node/test/worker_threads.ts @@ -10,6 +10,7 @@ import { createContext } from "vm"; resourceLimits: { codeRangeSizeMb: 123, }, + argv: ['asd'], workerData: script }); worker.on('message', resolve); diff --git a/types/node/tls.d.ts b/types/node/tls.d.ts index 13c3fbeea5..a1a03b5644 100644 --- a/types/node/tls.d.ts +++ b/types/node/tls.d.ts @@ -62,6 +62,11 @@ declare module "tls" { * SSL/TLS protocol version. */ version: string; + + /** + * IETF name for the cipher suite. + */ + standardName: string; } interface EphemeralKeyInfo { @@ -389,6 +394,40 @@ declare module "tls" { * 48-bytes of cryptographically strong pseudo-random data. */ ticketKeys?: Buffer; + + /** + * + * @param socket + * @param identity identity parameter sent from the client. + * @return pre-shared key that must either be + * a buffer or `null` to stop the negotiation process. Returned PSK must be + * compatible with the selected cipher's digest. + * + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with the identity provided by the client. + * If the return value is `null` the negotiation process will stop and an + * "unknown_psk_identity" alert message will be sent to the other party. + * If the server wishes to hide the fact that the PSK identity was not known, + * the callback must provide some random data as `psk` to make the connection + * fail with "decrypt_error" before negotiation is finished. + * PSK ciphers are disabled by default, and using TLS-PSK thus + * requires explicitly specifying a cipher suite with the `ciphers` option. + * More information can be found in the RFC 4279. + */ + + pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; + /** + * hint to send to a client to help + * with selecting the identity during TLS-PSK negotiation. Will be ignored + * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be + * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. + */ + pskIdentityHint?: string; + } + + interface PSKCallbackNegotation { + psk: DataView | NodeJS.TypedArray; + identitty: string; } interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { @@ -402,6 +441,24 @@ declare module "tls" { minDHSize?: number; lookup?: net.LookupFunction; timeout?: number; + /** + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with optional identity `hint` provided by the server or `null` + * in case of TLS 1.3 where `hint` was removed. + * It will be necessary to provide a custom `tls.checkServerIdentity()` + * for the connection as the default one will try to check hostname/IP + * of the server against the certificate but that's not applicable for PSK + * because there won't be a certificate present. + * More information can be found in the RFC 4279. + * + * @param hint message sent from the server to help client + * decide which identity to use during negotiation. + * Always `null` if TLS 1.3 is used. + * @returns Return `null` to stop the negotiation process. `psk` must be + * compatible with the selected cipher's digest. + * `identity` must use UTF-8 encoding. + */ + pskCallback?(hint: string | null): PSKCallbackNegotation | null; } class Server extends net.Server { diff --git a/types/node/ts3.2/fs.d.ts b/types/node/ts3.5/fs.d.ts similarity index 100% rename from types/node/ts3.2/fs.d.ts rename to types/node/ts3.5/fs.d.ts diff --git a/types/node/ts3.2/globals.d.ts b/types/node/ts3.5/globals.d.ts similarity index 100% rename from types/node/ts3.2/globals.d.ts rename to types/node/ts3.5/globals.d.ts diff --git a/types/node/ts3.2/index.d.ts b/types/node/ts3.5/index.d.ts similarity index 77% rename from types/node/ts3.2/index.d.ts rename to types/node/ts3.5/index.d.ts index 4814cd8dfd..6a31db6c8c 100644 --- a/types/node/ts3.2/index.d.ts +++ b/types/node/ts3.5/index.d.ts @@ -1,4 +1,4 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2. +// NOTE: These definitions support NodeJS and TypeScript 3.5. // Reference required types from the default lib: /// @@ -10,7 +10,8 @@ // tslint:disable-next-line:no-bad-reference /// -// TypeScript 3.2-specific augmentations: +// TypeScript 3.5-specific augmentations: /// /// /// +/// diff --git a/types/node/ts3.2/node-tests.ts b/types/node/ts3.5/node-tests.ts similarity index 83% rename from types/node/ts3.2/node-tests.ts rename to types/node/ts3.5/node-tests.ts index 3bed46b5e3..cd71b4a10b 100644 --- a/types/node/ts3.2/node-tests.ts +++ b/types/node/ts3.5/node-tests.ts @@ -73,3 +73,19 @@ import { BigIntStats, statSync, Stats } from 'fs'; b = a.readBigUInt64LE(123); b = a.readBigUInt64BE(123); } + +import { WASI } from 'wasi'; + +const wasi = new WASI({ + args: process.argv, + env: process.env, + preopens: { + '/sandbox': '/some/real/path/that/wasm/can/access' + } +}); +const importObject = { wasi_unstable: wasi.wasiImport }; +(async () => { + const wasm = await WebAssembly.compile(Buffer.from('dummy')); + const instance = await WebAssembly.instantiate(wasm, importObject); + wasi.start(instance); +})(); diff --git a/types/node/ts3.2/tsconfig.json b/types/node/ts3.5/tsconfig.json similarity index 100% rename from types/node/ts3.2/tsconfig.json rename to types/node/ts3.5/tsconfig.json diff --git a/types/node/ts3.2/tslint.json b/types/node/ts3.5/tslint.json similarity index 100% rename from types/node/ts3.2/tslint.json rename to types/node/ts3.5/tslint.json diff --git a/types/node/ts3.2/util.d.ts b/types/node/ts3.5/util.d.ts similarity index 100% rename from types/node/ts3.2/util.d.ts rename to types/node/ts3.5/util.d.ts diff --git a/types/node/ts3.5/wasi.d.ts b/types/node/ts3.5/wasi.d.ts new file mode 100644 index 0000000000..50c147e4df --- /dev/null +++ b/types/node/ts3.5/wasi.d.ts @@ -0,0 +1,45 @@ +declare module 'wasi' { + interface WASIOptions { + /** + * An array of strings that the WebAssembly application will + * see as command line arguments. The first argument is the virtual path to the + * WASI command itself. + */ + args?: string[]; + /** + * An object similar to `process.env` that the WebAssembly + * application will see as its environment. + */ + env?: object; + /** + * This object represents the WebAssembly application's + * sandbox directory structure. The string keys of `preopens` are treated as + * directories within the sandbox. The corresponding values in `preopens` are + * the real paths to those directories on the host machine. + */ + preopens?: { + [key: string]: string; + }; + } + + class WASI { + constructor(options?: WASIOptions); + /** + * + * Attempt to begin execution of `instance` by invoking its `_start()` export. + * If `instance` does not contain a `_start()` export, then `start()` attempts to + * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports + * is present on `instance`, then `start()` does nothing. + * + * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named + * `memory`. If `instance` does not have a `memory` export an exception is thrown. + */ + start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. + /** + * Is an object that implements the WASI system call API. This object + * should be passed as the `wasi_unstable` import during the instantiation of a + * [`WebAssembly.Instance`][]. + */ + readonly wasiImport: { [key: string]: any }; // TODO: Narrow to DOM types + } +} diff --git a/types/node/tsconfig.json b/types/node/tsconfig.json index 53ace26dc8..f5b245a474 100644 --- a/types/node/tsconfig.json +++ b/types/node/tsconfig.json @@ -54,4 +54,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +} diff --git a/types/node/util.d.ts b/types/node/util.d.ts index abbf49b894..85a5ad8138 100644 --- a/types/node/util.d.ts +++ b/types/node/util.d.ts @@ -1,5 +1,10 @@ declare module "util" { interface InspectOptions extends NodeJS.InspectOptions { } + type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module'; + type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string; + interface InspectOptionsStylized extends InspectOptions { + stylize(text: string, styleType: Style): string; + } function format(format: any, ...param: any[]): string; function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string; /** @deprecated since v0.11.3 - use a third party module instead. */ @@ -11,7 +16,7 @@ declare module "util" { [color: string]: [number, number] | undefined }; let styles: { - [style: string]: string | undefined + [K in Style]: string }; let defaultOptions: InspectOptions; /** diff --git a/types/node/worker_threads.d.ts b/types/node/worker_threads.d.ts index 67048a8cd9..07336f7236 100644 --- a/types/node/worker_threads.d.ts +++ b/types/node/worker_threads.d.ts @@ -54,6 +54,13 @@ declare module "worker_threads" { } interface WorkerOptions { + /** + * List of arguments which would be stringified and appended to + * `process.argv` in the worker. This is mostly similar to the `workerData` + * but the values will be available on the global `process.argv` as if they + * were passed as CLI options to the script. + */ + argv?: any[]; eval?: boolean; workerData?: any; stdin?: boolean; diff --git a/types/promise-fs/promise-fs-tests.ts b/types/promise-fs/promise-fs-tests.ts index 761fd3ce1e..422dd82e5f 100644 --- a/types/promise-fs/promise-fs-tests.ts +++ b/types/promise-fs/promise-fs-tests.ts @@ -57,7 +57,7 @@ write(9, "hello", null, "utf-8") rename("old", "new"); // $ExpectType Promise -rmdir("trash/unwanted", { maxBusyTries: 5 }); +rmdir("trash/unwanted", { maxRetries: 5 }); // $ExpectType Promise mkdir("new/goodies");