@types/node 15.3.0 → 15.6.2

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: Fri, 14 May 2021 19:01:37 GMT
11
+ * Last updated: Wed, 02 Jun 2021 07:31:33 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/child_process.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  declare module 'child_process' {
2
2
  import { BaseEncodingOptions } from 'fs';
3
- import * as events from 'events';
3
+ import { EventEmitter, Abortable } from 'events';
4
4
  import * as net from 'net';
5
5
  import { Writable, Readable, Stream, Pipe } from 'stream';
6
6
 
7
7
  type Serializable = string | object | number | boolean;
8
8
  type SendHandle = net.Socket | net.Server;
9
9
 
10
- interface ChildProcess extends events.EventEmitter {
10
+ interface ChildProcess extends EventEmitter {
11
11
  stdin: Writable | null;
12
12
  stdout: Readable | null;
13
13
  stderr: Readable | null;
@@ -129,7 +129,9 @@ declare module 'child_process' {
129
129
  keepOpen?: boolean;
130
130
  }
131
131
 
132
- type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>;
132
+ type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
133
+
134
+ type StdioOptions = IOType | Array<(IOType | "ipc" | Stream | number | null | undefined)>;
133
135
 
134
136
  type SerializationType = 'json' | 'advanced';
135
137
 
@@ -159,7 +161,7 @@ declare module 'child_process' {
159
161
  timeout?: number;
160
162
  }
161
163
 
162
- interface CommonSpawnOptions extends CommonOptions, MessagingOptions {
164
+ interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
163
165
  argv0?: string;
164
166
  stdio?: StdioOptions;
165
167
  shell?: boolean | string;
@@ -171,11 +173,12 @@ declare module 'child_process' {
171
173
  }
172
174
 
173
175
  interface SpawnOptionsWithoutStdio extends SpawnOptions {
174
- stdio?: 'pipe' | Array<null | undefined | 'pipe'>;
176
+ stdio?: StdioPipeNamed | StdioPipe[];
175
177
  }
176
178
 
177
179
  type StdioNull = 'inherit' | 'ignore' | Stream;
178
- type StdioPipe = undefined | null | 'pipe';
180
+ type StdioPipeNamed = 'pipe' | 'overlapped';
181
+ type StdioPipe = undefined | null | StdioPipeNamed;
179
182
 
180
183
  interface SpawnOptionsWithStdioTuple<
181
184
  Stdin extends StdioNull | StdioPipe,
@@ -330,11 +333,12 @@ declare module 'child_process' {
330
333
  function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
331
334
  }
332
335
 
333
- interface ExecFileOptions extends CommonOptions {
336
+ interface ExecFileOptions extends CommonOptions, Abortable {
334
337
  maxBuffer?: number;
335
338
  killSignal?: NodeJS.Signals | number;
336
339
  windowsVerbatimArguments?: boolean;
337
340
  shell?: boolean | string;
341
+ signal?: AbortSignal;
338
342
  }
339
343
  interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
340
344
  encoding: BufferEncoding;
@@ -434,7 +438,7 @@ declare module 'child_process' {
434
438
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
435
439
  }
436
440
 
437
- interface ForkOptions extends ProcessEnvOptions, MessagingOptions {
441
+ interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
438
442
  execPath?: string;
439
443
  execArgv?: string[];
440
444
  silent?: boolean;
node/crypto.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  declare module 'crypto' {
2
2
  import * as stream from 'stream';
3
+ import { PeerCertificate } from 'tls';
3
4
 
4
5
  interface Certificate {
5
6
  /**
@@ -1267,4 +1268,189 @@ declare module 'crypto' {
1267
1268
  * or if the derived key cannot be generated.
1268
1269
  */
1269
1270
  function hkdfSync(digest: string, key: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer;
1271
+
1272
+ interface SecureHeapUsage {
1273
+ /**
1274
+ * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
1275
+ */
1276
+ total: number;
1277
+
1278
+ /**
1279
+ * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag.
1280
+ */
1281
+ min: number;
1282
+
1283
+ /**
1284
+ * The total number of bytes currently allocated from the secure heap.
1285
+ */
1286
+ used: number;
1287
+
1288
+ /**
1289
+ * The calculated ratio of `used` to `total` allocated bytes.
1290
+ */
1291
+ utilization: number;
1292
+ }
1293
+
1294
+ function secureHeapUsed(): SecureHeapUsage;
1295
+
1296
+ // TODO: X509Certificate
1297
+
1298
+ interface RandomUUIDOptions {
1299
+ /**
1300
+ * By default, to improve performance,
1301
+ * Node.js will pre-emptively generate and persistently cache enough
1302
+ * random data to generate up to 128 random UUIDs. To generate a UUID
1303
+ * without using the cache, set `disableEntropyCache` to `true`.
1304
+ *
1305
+ * @default `false`
1306
+ */
1307
+ disableEntropyCache?: boolean;
1308
+ }
1309
+
1310
+ function randomUUID(options?: RandomUUIDOptions): string;
1311
+
1312
+ interface X509CheckOptions {
1313
+ /**
1314
+ * @default 'always'
1315
+ */
1316
+ subject: 'always' | 'never';
1317
+
1318
+ /**
1319
+ * @default true
1320
+ */
1321
+ wildcards: boolean;
1322
+
1323
+ /**
1324
+ * @default true
1325
+ */
1326
+ partialWildcards: boolean;
1327
+
1328
+ /**
1329
+ * @default false
1330
+ */
1331
+ multiLabelWildcards: boolean;
1332
+
1333
+ /**
1334
+ * @default false
1335
+ */
1336
+ singleLabelSubdomains: boolean;
1337
+ }
1338
+
1339
+ class X509Certificate {
1340
+ /**
1341
+ * Will be `true` if this is a Certificate Authority (ca) certificate.
1342
+ */
1343
+ readonly ca: boolean;
1344
+
1345
+ /**
1346
+ * The SHA-1 fingerprint of this certificate.
1347
+ */
1348
+ readonly fingerprint: string;
1349
+
1350
+ /**
1351
+ * The SHA-256 fingerprint of this certificate.
1352
+ */
1353
+ readonly fingerprint256: string;
1354
+
1355
+ /**
1356
+ * The complete subject of this certificate.
1357
+ */
1358
+ readonly subject: string;
1359
+
1360
+ /**
1361
+ * The subject alternative name specified for this certificate.
1362
+ */
1363
+ readonly subjectAltName: string;
1364
+
1365
+ /**
1366
+ * The information access content of this certificate.
1367
+ */
1368
+ readonly infoAccess: string;
1369
+
1370
+ /**
1371
+ * An array detailing the key usages for this certificate.
1372
+ */
1373
+ readonly keyUsage: string[];
1374
+
1375
+ /**
1376
+ * The public key for this certificate.
1377
+ */
1378
+ readonly publicKey: KeyObject;
1379
+
1380
+ /**
1381
+ * A `Buffer` containing the DER encoding of this certificate.
1382
+ */
1383
+ readonly raw: Buffer;
1384
+
1385
+ /**
1386
+ * The serial number of this certificate.
1387
+ */
1388
+ readonly serialNumber: string;
1389
+
1390
+ /**
1391
+ * Returns the PEM-encoded certificate.
1392
+ */
1393
+ readonly validFrom: string;
1394
+
1395
+ /**
1396
+ * The date/time from which this certificate is considered valid.
1397
+ */
1398
+ readonly validTo: string;
1399
+
1400
+ constructor(buffer: BinaryLike);
1401
+
1402
+ /**
1403
+ * Checks whether the certificate matches the given email address.
1404
+ *
1405
+ * Returns `email` if the certificate matches,`undefined` if it does not.
1406
+ */
1407
+ checkEmail(email: string, options?: X509CheckOptions): string | undefined;
1408
+
1409
+ /**
1410
+ * Checks whether the certificate matches the given host name.
1411
+ *
1412
+ * Returns `name` if the certificate matches, `undefined` if it does not.
1413
+ */
1414
+ checkHost(name: string, options?: X509CheckOptions): string | undefined;
1415
+
1416
+ /**
1417
+ * Checks whether the certificate matches the given IP address (IPv4 or IPv6).
1418
+ *
1419
+ * Returns `ip` if the certificate matches, `undefined` if it does not.
1420
+ */
1421
+ checkIP(ip: string, options?: X509CheckOptions): string | undefined;
1422
+
1423
+ /**
1424
+ * Checks whether this certificate was issued by the given `otherCert`.
1425
+ */
1426
+ checkIssued(otherCert: X509Certificate): boolean;
1427
+
1428
+ /**
1429
+ * Checks whether this certificate was issued by the given `otherCert`.
1430
+ */
1431
+ checkPrivateKey(privateKey: KeyObject): boolean;
1432
+
1433
+ /**
1434
+ * There is no standard JSON encoding for X509 certificates. The
1435
+ * `toJSON()` method returns a string containing the PEM encoded
1436
+ * certificate.
1437
+ */
1438
+ toJSON(): string;
1439
+
1440
+ /**
1441
+ * Returns information about this certificate using the legacy [certificate object][] encoding.
1442
+ */
1443
+ toLegacyObject(): PeerCertificate;
1444
+
1445
+ /**
1446
+ * Returns the PEM-encoded certificate.
1447
+ */
1448
+ toString(): string;
1449
+
1450
+ /**
1451
+ * Verifies that this certificate was signed by the given public key.
1452
+ * Does not perform any other validation checks on the certificate.
1453
+ */
1454
+ verify(publicKey: KeyObject): boolean;
1455
+ }
1270
1456
  }
node/events.d.ts CHANGED
@@ -57,6 +57,13 @@ declare module 'events' {
57
57
  namespace EventEmitter {
58
58
  // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
59
59
  export { internal as EventEmitter };
60
+
61
+ export interface Abortable {
62
+ /**
63
+ * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
64
+ */
65
+ signal?: AbortSignal;
66
+ }
60
67
  }
61
68
 
62
69
  global {
node/fs/promises.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  declare module 'fs/promises' {
2
+ import { Abortable } from 'events';
2
3
  import {
3
4
  Stats,
4
5
  BigIntStats,
@@ -16,7 +17,6 @@ declare module 'fs/promises' {
16
17
  BufferEncodingOption,
17
18
  OpenMode,
18
19
  Mode,
19
- Abortable,
20
20
  } from 'fs';
21
21
 
22
22
  interface FileHandle {
node/fs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare module 'fs' {
2
2
  import * as stream from 'stream';
3
- import EventEmitter = require('events');
3
+ import { Abortable, EventEmitter } from 'events';
4
4
  import { URL } from 'url';
5
5
  import * as promises from 'fs/promises';
6
6
 
@@ -142,11 +142,6 @@ declare module 'fs' {
142
142
  prependOnceListener(event: "close", listener: () => void): this;
143
143
  }
144
144
 
145
- // TODO: Move this to a more central location
146
- export interface Abortable {
147
- signal?: AbortSignal;
148
- }
149
-
150
145
  export class ReadStream extends stream.Readable {
151
146
  close(): void;
152
147
  bytesRead: number;
@@ -2067,15 +2062,10 @@ declare module 'fs' {
2067
2062
  */
2068
2063
  export function accessSync(path: PathLike, mode?: number): void;
2069
2064
 
2070
- /**
2071
- * Returns a new `ReadStream` object.
2072
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2073
- * URL support is _experimental_.
2074
- */
2075
- export function createReadStream(path: PathLike, options?: string | {
2065
+ interface StreamOptions {
2076
2066
  flags?: string;
2077
2067
  encoding?: BufferEncoding;
2078
- fd?: number;
2068
+ fd?: number | promises.FileHandle;
2079
2069
  mode?: number;
2080
2070
  autoClose?: boolean;
2081
2071
  /**
@@ -2083,25 +2073,26 @@ declare module 'fs' {
2083
2073
  */
2084
2074
  emitClose?: boolean;
2085
2075
  start?: number;
2086
- end?: number;
2087
2076
  highWaterMark?: number;
2088
- }): ReadStream;
2077
+ }
2078
+
2079
+ interface ReadStreamOptions extends StreamOptions {
2080
+ end?: number;
2081
+ }
2082
+
2083
+ /**
2084
+ * Returns a new `ReadStream` object.
2085
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2086
+ * URL support is _experimental_.
2087
+ */
2088
+ export function createReadStream(path: PathLike, options?: string | ReadStreamOptions): ReadStream;
2089
2089
 
2090
2090
  /**
2091
2091
  * Returns a new `WriteStream` object.
2092
2092
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2093
2093
  * URL support is _experimental_.
2094
2094
  */
2095
- export function createWriteStream(path: PathLike, options?: string | {
2096
- flags?: string;
2097
- encoding?: BufferEncoding;
2098
- fd?: number;
2099
- mode?: number;
2100
- autoClose?: boolean;
2101
- emitClose?: boolean;
2102
- start?: number;
2103
- highWaterMark?: number;
2104
- }): WriteStream;
2095
+ export function createWriteStream(path: PathLike, options?: string | StreamOptions): WriteStream;
2105
2096
 
2106
2097
  /**
2107
2098
  * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
node/globals.d.ts CHANGED
@@ -622,6 +622,10 @@ declare namespace NodeJS {
622
622
  '.node': (m: Module, filename: string) => any;
623
623
  }
624
624
  interface Module {
625
+ /**
626
+ * `true` if the module is running during the Node.js preload
627
+ */
628
+ isPreloading: boolean;
625
629
  exports: any;
626
630
  require: Require;
627
631
  id: string;
node/http.d.ts CHANGED
@@ -167,7 +167,7 @@ declare module 'http' {
167
167
  finished: boolean;
168
168
  headersSent: boolean;
169
169
  /**
170
- * @deprecate Use `socket` instead.
170
+ * @deprecated Use `socket` instead.
171
171
  */
172
172
  connection: Socket | null;
173
173
  socket: Socket | null;
@@ -175,7 +175,7 @@ declare module 'http' {
175
175
  constructor();
176
176
 
177
177
  setTimeout(msecs: number, callback?: () => void): this;
178
- setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
178
+ setHeader(name: string, value: number | string | ReadonlyArray<string>): this;
179
179
  getHeader(name: string): number | string | string[] | undefined;
180
180
  getHeaders(): OutgoingHttpHeaders;
181
181
  getHeaderNames(): string[];
@@ -374,7 +374,8 @@ declare module 'http' {
374
374
  */
375
375
  timeout?: number;
376
376
  /**
377
- * Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'.
377
+ * Scheduling strategy to apply when picking the next free socket to use.
378
+ * @default `lifo`
378
379
  */
379
380
  scheduling?: 'fifo' | 'lifo';
380
381
  }
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 15.3
1
+ // Type definitions for non-npm package Node.js 15.6
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/net.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare module 'net' {
2
2
  import * as stream from 'stream';
3
- import EventEmitter = require('events');
3
+ import { Abortable, EventEmitter } from 'events';
4
4
  import * as dns from 'dns';
5
5
 
6
6
  type LookupFunction = (
@@ -168,7 +168,7 @@ declare module 'net' {
168
168
  prependOnceListener(event: "timeout", listener: () => void): this;
169
169
  }
170
170
 
171
- interface ListenOptions {
171
+ interface ListenOptions extends Abortable {
172
172
  port?: number;
173
173
  host?: string;
174
174
  backlog?: number;
node/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "15.3.0",
3
+ "version": "15.6.2",
4
4
  "description": "TypeScript definitions for Node.js",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
5
6
  "license": "MIT",
6
7
  "contributors": [
7
8
  {
@@ -226,6 +227,6 @@
226
227
  },
227
228
  "scripts": {},
228
229
  "dependencies": {},
229
- "typesPublisherContentHash": "db9f33705bb813befe4fef062f49dad7d922e4feb6d132c446fd94911812a697",
230
- "typeScriptVersion": "3.5"
230
+ "typesPublisherContentHash": "f62422deccbd466260cb63740d207022259eb7fc7b6e7c406be463b9d1b0cd19",
231
+ "typeScriptVersion": "3.6"
231
232
  }
node/perf_hooks.d.ts CHANGED
@@ -88,7 +88,10 @@ declare module 'perf_hooks' {
88
88
  * @param util1 The result of a previous call to eventLoopUtilization()
89
89
  * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
90
90
  */
91
- type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
91
+ type EventLoopUtilityFunction = (
92
+ util1?: EventLoopUtilization,
93
+ util2?: EventLoopUtilization,
94
+ ) => EventLoopUtilization;
92
95
 
93
96
  interface Performance {
94
97
  /**
@@ -122,7 +125,7 @@ declare module 'perf_hooks' {
122
125
  * @param startMark
123
126
  * @param endMark
124
127
  */
125
- measure(name: string, startMark: string, endMark: string): void;
128
+ measure(name: string, startMark?: string, endMark?: string): void;
126
129
 
127
130
  /**
128
131
  * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
node/process.d.ts CHANGED
@@ -11,6 +11,18 @@ declare module 'process' {
11
11
  interface ReadStream extends tty.ReadStream {}
12
12
  interface WriteStream extends tty.WriteStream {}
13
13
 
14
+ interface MemoryUsageFn {
15
+ /**
16
+ * The `process.memoryUsage()` method iterate over each page to gather informations about memory
17
+ * usage which can be slow depending on the program memory allocations.
18
+ */
19
+ (): MemoryUsage;
20
+ /**
21
+ * method returns an integer representing the Resident Set Size (RSS) in bytes.
22
+ */
23
+ rss(): number;
24
+ }
25
+
14
26
  interface MemoryUsage {
15
27
  rss: number;
16
28
  heapTotal: number;
@@ -289,7 +301,7 @@ declare module 'process' {
289
301
  platform: Platform;
290
302
  /** @deprecated since v14.0.0 - use `require.main` instead. */
291
303
  mainModule?: Module;
292
- memoryUsage(): MemoryUsage;
304
+ memoryUsage: MemoryUsageFn;
293
305
  cpuUsage(previousValue?: CpuUsage): CpuUsage;
294
306
  nextTick(callback: Function, ...args: any[]): void;
295
307
  release: ProcessRelease;
node/stream.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module 'stream' {
2
- import EventEmitter = require('events');
2
+ import { EventEmitter, Abortable } from 'events';
3
3
  import * as streamPromises from "stream/promises";
4
4
 
5
5
  class internal extends EventEmitter {
@@ -11,16 +11,20 @@ declare module 'stream' {
11
11
  constructor(opts?: ReadableOptions);
12
12
  }
13
13
 
14
- interface ReadableOptions {
14
+ interface StreamOptions<T extends Stream> extends Abortable {
15
+ emitClose?: boolean;
15
16
  highWaterMark?: number;
16
- encoding?: BufferEncoding;
17
17
  objectMode?: boolean;
18
- read?(this: Readable, size: number): void;
19
- construct?(this: Readable, callback: (error?: Error | null) => void): void;
20
- destroy?(this: Readable, error: Error | null, callback: (error: Error | null) => void): void;
18
+ construct?(this: T, callback: (error?: Error | null) => void): void;
19
+ destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void;
21
20
  autoDestroy?: boolean;
22
21
  }
23
22
 
23
+ interface ReadableOptions extends StreamOptions<Readable> {
24
+ encoding?: BufferEncoding;
25
+ read?(this: Readable, size: number): void;
26
+ }
27
+
24
28
  class Readable extends Stream implements NodeJS.ReadableStream {
25
29
  /**
26
30
  * A utility method for creating Readable Streams out of iterators.
@@ -127,18 +131,12 @@ declare module 'stream' {
127
131
  [Symbol.asyncIterator](): AsyncIterableIterator<any>;
128
132
  }
129
133
 
130
- interface WritableOptions {
131
- highWaterMark?: number;
134
+ interface WritableOptions extends StreamOptions<Writable> {
132
135
  decodeStrings?: boolean;
133
136
  defaultEncoding?: BufferEncoding;
134
- objectMode?: boolean;
135
- emitClose?: boolean;
136
- construct?(this: Writable, callback: (error?: Error | null) => void): void;
137
137
  write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
138
138
  writev?(this: Writable, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
139
- destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void;
140
139
  final?(this: Writable, callback: (error?: Error | null) => void): void;
141
- autoDestroy?: boolean;
142
140
  }
143
141
 
144
142
  class Writable extends Stream implements NodeJS.WritableStream {
@@ -293,6 +291,16 @@ declare module 'stream' {
293
291
 
294
292
  class PassThrough extends Transform { }
295
293
 
294
+ /**
295
+ * Attaches an AbortSignal to a readable or writeable stream. This lets code
296
+ * control stream destruction using an `AbortController`.
297
+ *
298
+ * Calling `abort` on the `AbortController` corresponding to the passed
299
+ * `AbortSignal` will behave the same way as calling `.destroy(new AbortError())`
300
+ * on the stream.
301
+ */
302
+ function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
303
+
296
304
  interface FinishedOptions {
297
305
  error?: boolean;
298
306
  readable?: boolean;
node/tls.d.ts CHANGED
@@ -553,6 +553,9 @@ declare module 'tls' {
553
553
  prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
554
554
  }
555
555
 
556
+ /**
557
+ * @deprecated since v0.11.3 Use `tls.TLSSocket` instead.
558
+ */
556
559
  interface SecurePair {
557
560
  encrypted: TLSSocket;
558
561
  cleartext: TLSSocket;
node/util/types.d.ts CHANGED
@@ -51,7 +51,3 @@ declare module 'util/types' {
51
51
  function isWeakMap(object: any): object is WeakMap<any, any>;
52
52
  function isWeakSet(object: any): object is WeakSet<any>;
53
53
  }
54
-
55
- declare module 'node:util/types' {
56
- export * from 'util/types';
57
- }
node/worker_threads.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  declare module 'worker_threads' {
2
2
  import { Context } from 'vm';
3
- import EventEmitter = require('events');
3
+ import { EventEmitter } from 'events';
4
+ import { EventLoopUtilityFunction } from 'perf_hooks';
5
+ import { FileHandle } from 'fs/promises';
4
6
  import { Readable, Writable } from 'stream';
5
7
  import { URL } from 'url';
6
- import { FileHandle } from 'fs/promises';
7
- import { EventLoopUtilityFunction } from 'perf_hooks';
8
+ import { X509Certificate } from 'crypto';
8
9
 
9
10
  const isMainThread: boolean;
10
11
  const parentPort: null | MessagePort;
@@ -19,10 +20,10 @@ declare module 'worker_threads' {
19
20
  }
20
21
 
21
22
  interface WorkerPerformance {
22
- eventLoopUtilitzation: EventLoopUtilityFunction;
23
+ eventLoopUtilization: EventLoopUtilityFunction;
23
24
  }
24
25
 
25
- type TransferListItem = ArrayBuffer | MessagePort | FileHandle;
26
+ type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate;
26
27
 
27
28
  class MessagePort extends EventEmitter {
28
29
  close(): void;
@@ -209,6 +210,22 @@ declare module 'worker_threads' {
209
210
  off(event: string | symbol, listener: (...args: any[]) => void): this;
210
211
  }
211
212
 
213
+ interface BroadcastChannel extends NodeJS.RefCounted {}
214
+
215
+ /**
216
+ * See https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
217
+ */
218
+ class BroadcastChannel {
219
+ readonly name: string;
220
+ onmessage: (message: unknown) => void;
221
+ onmessageerror: (message: unknown) => void;
222
+
223
+ constructor(name: string);
224
+
225
+ close(): void;
226
+ postMessage(message: unknown): void;
227
+ }
228
+
212
229
  /**
213
230
  * Mark an object as not transferable.
214
231
  * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.