@types/node 11.12.4 → 11.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js ( http://nodejs.org/ ).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
9
9
 
10
10
  Additional Details
11
- * Last updated: Mon, 01 Apr 2019 19:34:50 GMT
11
+ * Last updated: Wed, 10 Apr 2019 17:21:43 GMT
12
12
  * Dependencies: none
13
13
  * Global values: Buffer, NodeJS, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, queueMicrotask, require, setImmediate, setInterval, setTimeout
14
14
 
node/crypto.d.ts CHANGED
@@ -261,7 +261,7 @@ declare module "crypto" {
261
261
  }
262
262
 
263
263
  function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject;
264
- function createPublicKey(key: PublicKeyInput | string | Buffer): KeyObject;
264
+ function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
265
265
  function createSecretKey(key: Buffer): KeyObject;
266
266
 
267
267
  function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
node/events.d.ts CHANGED
@@ -2,6 +2,7 @@ declare module "events" {
2
2
  class internal extends NodeJS.EventEmitter { }
3
3
 
4
4
  namespace internal {
5
+ function once(emitter: EventEmitter, event: string | symbol): Promise<any>;
5
6
  class EventEmitter extends internal {
6
7
  /** @deprecated since v4.0.0 */
7
8
  static listenerCount(emitter: EventEmitter, event: string | symbol): number;
node/globals.d.ts CHANGED
@@ -45,7 +45,7 @@ interface Console {
45
45
  /**
46
46
  * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
47
47
  */
48
- groupCollapsed(): void;
48
+ groupCollapsed(...label: any[]): void;
49
49
  /**
50
50
  * Decreases indentation of subsequent lines by two spaces.
51
51
  */
@@ -233,12 +233,12 @@ declare var module: NodeModule;
233
233
  declare var exports: any;
234
234
 
235
235
  // Buffer class
236
- type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex";
236
+ type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
237
237
  interface Buffer extends Uint8Array {
238
238
  constructor: typeof Buffer;
239
- write(string: string, encoding?: string): number;
240
- write(string: string, offset: number, encoding?: string): number;
241
- write(string: string, offset: number, length: number, encoding?: string): number;
239
+ write(string: string, encoding?: BufferEncoding): number;
240
+ write(string: string, offset: number, encoding?: BufferEncoding): number;
241
+ write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
242
242
  toString(encoding?: string, start?: number, end?: number): string;
243
243
  toJSON(): { type: 'Buffer', data: number[] };
244
244
  equals(otherBuffer: Uint8Array): boolean;
@@ -287,10 +287,10 @@ interface Buffer extends Uint8Array {
287
287
  writeDoubleLE(value: number, offset: number): number;
288
288
  writeDoubleBE(value: number, offset: number): number;
289
289
  fill(value: any, offset?: number, end?: number): this;
290
- indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: string): number;
291
- lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: string): number;
290
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
291
+ lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
292
292
  entries(): IterableIterator<[number, number]>;
293
- includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
293
+ includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
294
294
  keys(): IterableIterator<number>;
295
295
  values(): IterableIterator<number>;
296
296
  }
@@ -308,7 +308,7 @@ declare const Buffer: {
308
308
  * @param encoding encoding to use, optional. Default is 'utf8'
309
309
  * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
310
310
  */
311
- new(str: string, encoding?: string): Buffer;
311
+ new(str: string, encoding?: BufferEncoding): Buffer;
312
312
  /**
313
313
  * Allocates a new buffer of {size} octets.
314
314
  *
@@ -367,7 +367,7 @@ declare const Buffer: {
367
367
  * If provided, the {encoding} parameter identifies the character encoding.
368
368
  * If not provided, {encoding} defaults to 'utf8'.
369
369
  */
370
- from(str: string, encoding?: string): Buffer;
370
+ from(str: string, encoding?: BufferEncoding): Buffer;
371
371
  /**
372
372
  * Creates a new Buffer using the passed {data}
373
373
  * @param values to create a new Buffer
@@ -385,7 +385,7 @@ declare const Buffer: {
385
385
  *
386
386
  * @param encoding string to test.
387
387
  */
388
- isEncoding(encoding: string): boolean | undefined;
388
+ isEncoding(encoding: string): encoding is BufferEncoding
389
389
  /**
390
390
  * Gives the actual byte length of a string. encoding defaults to 'utf8'.
391
391
  * This is not the same as String.prototype.length since that returns the number of characters in a string.
@@ -393,7 +393,7 @@ declare const Buffer: {
393
393
  * @param string string to test.
394
394
  * @param encoding encoding used to evaluate (defaults to 'utf8')
395
395
  */
396
- byteLength(string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: string): number;
396
+ byteLength(string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
397
397
  /**
398
398
  * Returns a buffer which is the result of concatenating all the buffers in the list together.
399
399
  *
@@ -418,7 +418,7 @@ declare const Buffer: {
418
418
  * If parameter is omitted, buffer will be filled with zeros.
419
419
  * @param encoding encoding used for call to buf.fill while initalizing
420
420
  */
421
- alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
421
+ alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
422
422
  /**
423
423
  * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
424
424
  * of the newly created Buffer are unknown and may contain sensitive data.
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 11.12
1
+ // Type definitions for non-npm package Node.js 11.13
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "11.12.4",
3
+ "version": "11.13.3",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -206,6 +206,6 @@
206
206
  },
207
207
  "scripts": {},
208
208
  "dependencies": {},
209
- "typesPublisherContentHash": "acd2a15c38a9c89ae212cf7bae04bb1980689bdb26fe8a3201a5bfaa39c48cb6",
209
+ "typesPublisherContentHash": "63fa42bcd8b2cf54eb20f7b4198df34b302bd97b97235e575a7660e7a52f1c51",
210
210
  "typeScriptVersion": "2.0"
211
211
  }
node/querystring.d.ts CHANGED
@@ -10,7 +10,14 @@ declare module "querystring" {
10
10
 
11
11
  interface ParsedUrlQuery { [key: string]: string | string[]; }
12
12
 
13
- function stringify(obj?: {}, sep?: string, eq?: string, options?: StringifyOptions): string;
13
+ interface ParsedUrlQueryInput {
14
+ [key: string]:
15
+ // The value type here is a "poor man's `unknown`". When these types support TypeScript
16
+ // 3.0+, we can replace this with `unknown`.
17
+ {} | null | undefined;
18
+ }
19
+
20
+ function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
14
21
  function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
15
22
  function escape(str: string): string;
16
23
  function unescape(str: string): string;
node/tty.d.ts CHANGED
@@ -39,6 +39,9 @@ declare module "tty" {
39
39
  * @default `process.env`
40
40
  */
41
41
  getColorDepth(env?: {}): number;
42
+ hasColors(depth?: number): boolean;
43
+ hasColors(env?: {}): boolean;
44
+ hasColors(depth: number, env?: {}): boolean;
42
45
  getWindowSize(): [number, number];
43
46
  columns: number;
44
47
  rows: number;
node/url.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module "url" {
2
- import { ParsedUrlQuery } from 'querystring';
2
+ import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring';
3
3
 
4
4
  interface UrlObjectCommon {
5
5
  auth?: string;
@@ -17,7 +17,7 @@ declare module "url" {
17
17
  // Input to `url.format`
18
18
  interface UrlObject extends UrlObjectCommon {
19
19
  port?: string | number;
20
- query?: string | null | { [key: string]: any };
20
+ query?: string | null | ParsedUrlQueryInput;
21
21
  }
22
22
 
23
23
  // Output of `url.parse`
node/v8.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  declare module "v8" {
2
+ import { Readable } from "stream";
3
+
2
4
  interface HeapSpaceInfo {
3
5
  space_name: string;
4
6
  space_size: number;
@@ -25,4 +27,24 @@ declare module "v8" {
25
27
  function getHeapStatistics(): HeapInfo;
26
28
  function getHeapSpaceStatistics(): HeapSpaceInfo[];
27
29
  function setFlagsFromString(flags: string): void;
30
+ /**
31
+ * Generates a snapshot of the current V8 heap and returns a Readable
32
+ * Stream that may be used to read the JSON serialized representation.
33
+ * This conversation was marked as resolved by joyeecheung
34
+ * This JSON stream format is intended to be used with tools such as
35
+ * Chrome DevTools. The JSON schema is undocumented and specific to the
36
+ * V8 engine, and may change from one version of V8 to the next.
37
+ */
38
+ function getHeapSnapshot(): Readable;
39
+
40
+ /**
41
+ *
42
+ * @param fileName The file path where the V8 heap snapshot is to be
43
+ * saved. If not specified, a file name with the pattern
44
+ * `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be
45
+ * generated, where `{pid}` will be the PID of the Node.js process,
46
+ * `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from
47
+ * the main Node.js thread or the id of a worker thread.
48
+ */
49
+ function writeHeapSnapshot(fileName?: string): string;
28
50
  }
node/worker_threads.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  declare module "worker_threads" {
2
+ import { Context } from "vm";
2
3
  import { EventEmitter } from "events";
3
4
  import { Readable, Writable } from "stream";
4
5
 
@@ -73,6 +74,21 @@ declare module "worker_threads" {
73
74
  ref(): void;
74
75
  unref(): void;
75
76
  terminate(callback?: (err: Error, exitCode: number) => void): void;
77
+ /**
78
+ * Transfer a `MessagePort` to a different `vm` Context. The original `port`
79
+ * object will be rendered unusable, and the returned `MessagePort` instance will
80
+ * take its place.
81
+ *
82
+ * The returned `MessagePort` will be an object in the target context, and will
83
+ * inherit from its global `Object` class. Objects passed to the
84
+ * `port.onmessage()` listener will also be created in the target context
85
+ * and inherit from its global `Object` class.
86
+ *
87
+ * However, the created `MessagePort` will no longer inherit from
88
+ * `EventEmitter`, and only `port.onmessage()` can be used to receive
89
+ * events using it.
90
+ */
91
+ moveMessagePortToContext(port: MessagePort, context: Context): MessagePort;
76
92
 
77
93
  addListener(event: "error", listener: (err: Error) => void): this;
78
94
  addListener(event: "exit", listener: (exitCode: number) => void): this;