@types/node 15.0.0 → 15.3.0

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,9 +8,9 @@ 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, 26 Apr 2021 19:31:25 GMT
11
+ * Last updated: Fri, 14 May 2021 19:01:37 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
 
15
15
  # Credits
16
- These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), and [Yongsheng Zhang](https://github.com/ZYSzys).
16
+ These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), and [Yongsheng Zhang](https://github.com/ZYSzys).
node/assert.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- declare module 'node:assert' {
2
- import assert = require('assert');
3
- export = assert;
4
- }
5
-
6
1
  declare module 'assert' {
7
2
  /** An alias of `assert.ok()`. */
8
3
  function assert(value: any, message?: string | Error): asserts value;
node/async_hooks.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * Async Hooks module: https://nodejs.org/api/async_hooks.html
3
- */
4
- declare module 'node:async_hooks' {
5
- export * from 'async_hooks';
6
- }
7
-
8
1
  /**
9
2
  * Async Hooks module: https://nodejs.org/api/async_hooks.html
10
3
  */
@@ -92,7 +85,7 @@ declare module 'async_hooks' {
92
85
  interface AsyncResourceOptions {
93
86
  /**
94
87
  * The ID of the execution context that created this async event.
95
- * Default: `executionAsyncId()`
88
+ * @default executionAsyncId()
96
89
  */
97
90
  triggerAsyncId?: number;
98
91
 
@@ -101,7 +94,7 @@ declare module 'async_hooks' {
101
94
  * This usually does not need to be set (even if `emitDestroy` is called
102
95
  * manually), unless the resource's `asyncId` is retrieved and the
103
96
  * sensitive API's `emitDestroy` is called with it.
104
- * Default: `false`
97
+ * @default false
105
98
  */
106
99
  requireManualDestroy?: boolean;
107
100
  }
node/buffer.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- declare module 'node:buffer' {
2
- export * from 'buffer';
3
- }
4
-
5
1
  declare module 'buffer' {
6
2
  export const INSPECT_MAX_BYTES: number;
7
3
  export const kMaxLength: number;
node/child_process.d.ts CHANGED
@@ -1,12 +1,8 @@
1
- declare module 'node:child_process' {
2
- export * from 'child_process';
3
- }
4
-
5
1
  declare module 'child_process' {
6
- import { BaseEncodingOptions } from 'node:fs';
7
- import * as events from 'node:events';
8
- import * as net from 'node:net';
9
- import { Writable, Readable, Stream, Pipe } from 'node:stream';
2
+ import { BaseEncodingOptions } from 'fs';
3
+ import * as events from 'events';
4
+ import * as net from 'net';
5
+ import { Writable, Readable, Stream, Pipe } from 'stream';
10
6
 
11
7
  type Serializable = string | object | number | boolean;
12
8
  type SendHandle = net.Socket | net.Server;
@@ -45,6 +41,7 @@ declare module 'child_process' {
45
41
  * 3. error
46
42
  * 4. exit
47
43
  * 5. message
44
+ * 6. spawn
48
45
  */
49
46
 
50
47
  addListener(event: string, listener: (...args: any[]) => void): this;
@@ -53,6 +50,7 @@ declare module 'child_process' {
53
50
  addListener(event: "error", listener: (err: Error) => void): this;
54
51
  addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
55
52
  addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
53
+ addListener(event: "spawn", listener: () => void): this;
56
54
 
57
55
  emit(event: string | symbol, ...args: any[]): boolean;
58
56
  emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
@@ -60,6 +58,7 @@ declare module 'child_process' {
60
58
  emit(event: "error", err: Error): boolean;
61
59
  emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
62
60
  emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
61
+ emit(event: "spawn", listener: () => void): boolean;
63
62
 
64
63
  on(event: string, listener: (...args: any[]) => void): this;
65
64
  on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -67,6 +66,7 @@ declare module 'child_process' {
67
66
  on(event: "error", listener: (err: Error) => void): this;
68
67
  on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
69
68
  on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
69
+ on(event: "spawn", listener: () => void): this;
70
70
 
71
71
  once(event: string, listener: (...args: any[]) => void): this;
72
72
  once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -74,6 +74,7 @@ declare module 'child_process' {
74
74
  once(event: "error", listener: (err: Error) => void): this;
75
75
  once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
76
76
  once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
77
+ once(event: "spawn", listener: () => void): this;
77
78
 
78
79
  prependListener(event: string, listener: (...args: any[]) => void): this;
79
80
  prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -81,6 +82,7 @@ declare module 'child_process' {
81
82
  prependListener(event: "error", listener: (err: Error) => void): this;
82
83
  prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
83
84
  prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
85
+ prependListener(event: "spawn", listener: () => void): this;
84
86
 
85
87
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
86
88
  prependOnceListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -88,6 +90,7 @@ declare module 'child_process' {
88
90
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
89
91
  prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
90
92
  prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
93
+ prependOnceListener(event: "spawn", listener: () => void): this;
91
94
  }
92
95
 
93
96
  // return this object when stdio option is undefined or not specified
node/cluster.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- declare module 'node:cluster' {
2
- export * from 'cluster';
3
- }
4
-
5
1
  declare module 'cluster' {
6
- import * as child from 'node:child_process';
7
- import EventEmitter = require('node:events');
8
- import * as net from 'node:net';
2
+ import * as child from 'child_process';
3
+ import EventEmitter = require('events');
4
+ import * as net from 'net';
9
5
 
10
6
  // interfaces
11
7
  interface ClusterSettings {
node/console.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- declare module 'node:console' {
2
- export = console;
3
- }
4
-
5
1
  declare module 'console' {
6
- import { InspectOptions } from 'node:util';
2
+ import { InspectOptions } from 'util';
7
3
 
8
4
  global {
9
5
  // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
node/constants.d.ts CHANGED
@@ -1,14 +1,8 @@
1
- /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2
- declare module 'node:constants' {
3
- import exp = require('constants');
4
- export = exp;
5
- }
6
-
7
1
  /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
8
2
  declare module 'constants' {
9
- import { constants as osConstants, SignalConstants } from 'node:os';
10
- import { constants as cryptoConstants } from 'node:crypto';
11
- import { constants as fsConstants } from 'node:fs';
3
+ import { constants as osConstants, SignalConstants } from 'os';
4
+ import { constants as cryptoConstants } from 'crypto';
5
+ import { constants as fsConstants } from 'fs';
12
6
 
13
7
  const exp: typeof osConstants.errno &
14
8
  typeof osConstants.priority &
node/crypto.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- declare module 'node:crypto' {
2
- export * from 'crypto';
3
- }
4
-
5
1
  declare module 'crypto' {
6
- import * as stream from 'node:stream';
2
+ import * as stream from 'stream';
7
3
 
8
4
  interface Certificate {
9
5
  /**
node/dgram.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- declare module 'node:dgram' {
2
- export * from 'dgram';
3
- }
4
-
5
1
  declare module 'dgram' {
6
- import { AddressInfo } from 'node:net';
7
- import * as dns from 'node:dns';
8
- import EventEmitter = require('node:events');
2
+ import { AddressInfo } from 'net';
3
+ import * as dns from 'dns';
4
+ import EventEmitter = require('events');
9
5
 
10
6
  interface RemoteInfo {
11
7
  address: string;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @experimental
3
+ */
4
+ declare module 'diagnostic_channel' {
5
+ /**
6
+ * Returns wether a named channel has subscribers or not.
7
+ */
8
+ function hasSubscribers(name: string): boolean;
9
+
10
+ /**
11
+ * Gets or create a diagnostic channel by name.
12
+ */
13
+ function channel(name: string): Channel;
14
+
15
+ type ChannelListener = (name: string, message: unknown) => void;
16
+
17
+ /**
18
+ * Simple diagnostic channel that allows
19
+ */
20
+ class Channel {
21
+ readonly name: string;
22
+ readonly hashSubscribers: boolean;
23
+ private constructor(name: string);
24
+
25
+ /**
26
+ * Add a listener to the message channel.
27
+ */
28
+ subscribe(listener: ChannelListener): void;
29
+ /**
30
+ * Removes a previously registered listener.
31
+ */
32
+ unsubscribe(listener: ChannelListener): void;
33
+ }
34
+ }
node/dns/promises.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- declare module "node:dns/promises" {
2
- export * from "dns/promises";
3
- }
4
-
5
1
  declare module "dns/promises" {
6
2
  import {
7
3
  LookupAddress,
@@ -18,7 +14,7 @@ declare module "dns/promises" {
18
14
  RecordWithTtl,
19
15
  ResolveOptions,
20
16
  ResolverOptions,
21
- } from "node:dns";
17
+ } from "dns";
22
18
 
23
19
  function getServers(): string[];
24
20
 
node/dns.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- declare module 'node:dns' {
2
- export * from 'dns';
3
- }
4
-
5
1
  declare module 'dns' {
6
- import * as dnsPromises from "node:dns/promises";
2
+ import * as dnsPromises from "dns/promises";
7
3
 
8
4
  // Supported getaddrinfo flags.
9
5
  export const ADDRCONFIG: number;
node/domain.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- declare module 'node:domain' {
2
- export * from 'domain';
3
- }
4
-
5
1
  declare module 'domain' {
6
- import EventEmitter = require('node:events');
2
+ import EventEmitter = require('events');
7
3
 
8
4
  global {
9
5
  namespace NodeJS {
node/events.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- declare module 'node:events' {
2
- import EventEmitter = require('events');
3
- export = EventEmitter;
4
- }
5
-
6
1
  declare module 'events' {
7
2
  interface EventEmitterOptions {
8
3
  /**
@@ -33,6 +28,10 @@ declare module 'events' {
33
28
 
34
29
  /** @deprecated since v4.0.0 */
35
30
  static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
31
+ /**
32
+ * Returns a list listener for a specific emitter event name.
33
+ */
34
+ static getEventListener(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
36
35
 
37
36
  /**
38
37
  * This symbol shall be used to install a listener for only monitoring `'error'`
node/fs/promises.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  declare module 'fs/promises' {
2
- export * from 'node:fs/promises';
3
- }
4
-
5
- declare module 'node:fs/promises' {
6
2
  import {
7
3
  Stats,
8
4
  BigIntStats,
@@ -20,7 +16,8 @@ declare module 'node:fs/promises' {
20
16
  BufferEncodingOption,
21
17
  OpenMode,
22
18
  Mode,
23
- } from 'node:fs';
19
+ Abortable,
20
+ } from 'fs';
24
21
 
25
22
  interface FileHandle {
26
23
  /**
@@ -147,7 +144,7 @@ declare module 'node:fs/promises' {
147
144
  * If `mode` is a string, it is parsed as an octal integer.
148
145
  * If `flag` is not supplied, the default of `'w'` is used.
149
146
  */
150
- writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
147
+ writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } & Abortable | BufferEncoding | null): Promise<void>;
151
148
 
152
149
  /**
153
150
  * See `fs.writev` promisified version.
@@ -514,7 +511,7 @@ declare module 'node:fs/promises' {
514
511
  * If `mode` is a string, it is parsed as an octal integer.
515
512
  * If `flag` is not supplied, the default of `'w'` is used.
516
513
  */
517
- function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
514
+ function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } & Abortable | BufferEncoding | null): Promise<void>;
518
515
 
519
516
  /**
520
517
  * Asynchronously append data to a file, creating the file if it does not exist.
@@ -537,7 +534,7 @@ declare module 'node:fs/promises' {
537
534
  * @param options An object that may contain an optional flag.
538
535
  * If a flag is not provided, it defaults to `'r'`.
539
536
  */
540
- function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
537
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } & Abortable | null): Promise<Buffer>;
541
538
 
542
539
  /**
543
540
  * Asynchronously reads the entire contents of a file.
@@ -546,7 +543,7 @@ declare module 'node:fs/promises' {
546
543
  * @param options An object that may contain an optional flag.
547
544
  * If a flag is not provided, it defaults to `'r'`.
548
545
  */
549
- function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
546
+ function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } & Abortable | BufferEncoding): Promise<string>;
550
547
 
551
548
  /**
552
549
  * Asynchronously reads the entire contents of a file.
@@ -555,7 +552,7 @@ declare module 'node:fs/promises' {
555
552
  * @param options An object that may contain an optional flag.
556
553
  * If a flag is not provided, it defaults to `'r'`.
557
554
  */
558
- function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
555
+ function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & Abortable & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
559
556
 
560
557
  function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
561
558
  }
node/fs.d.ts CHANGED
@@ -1,12 +1,8 @@
1
- declare module 'node:fs' {
2
- export * from 'fs';
3
- }
4
-
5
1
  declare module 'fs' {
6
- import * as stream from 'node:stream';
7
- import EventEmitter = require('node:events');
8
- import { URL } from 'node:url';
9
- import * as promises from 'node:fs/promises';
2
+ import * as stream from 'stream';
3
+ import EventEmitter = require('events');
4
+ import { URL } from 'url';
5
+ import * as promises from 'fs/promises';
10
6
 
11
7
  export { promises };
12
8
  /**
@@ -146,6 +142,11 @@ declare module 'fs' {
146
142
  prependOnceListener(event: "close", listener: () => void): this;
147
143
  }
148
144
 
145
+ // TODO: Move this to a more central location
146
+ export interface Abortable {
147
+ signal?: AbortSignal;
148
+ }
149
+
149
150
  export class ReadStream extends stream.Readable {
150
151
  close(): void;
151
152
  bytesRead: number;
@@ -556,13 +557,21 @@ declare module 'fs' {
556
557
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
557
558
  }
558
559
 
560
+ export interface StatSyncFn<TDescriptor = PathLike> extends Function {
561
+ (path: TDescriptor, options?: undefined): Stats;
562
+ (path: TDescriptor, options?: StatOptions & { bigint?: false; throwIfNoEntry: false }): Stats | undefined;
563
+ (path: TDescriptor, options: StatOptions & { bigint: true; throwIfNoEntry: false }): BigIntStats | undefined;
564
+ (path: TDescriptor, options?: StatOptions & { bigint?: false }): Stats;
565
+ (path: TDescriptor, options: StatOptions & { bigint: true }): BigIntStats;
566
+ (path: TDescriptor, options: StatOptions & { bigint: boolean; throwIfNoEntry?: false }): Stats | BigIntStats;
567
+ (path: TDescriptor, options?: StatOptions): Stats | BigIntStats | undefined;
568
+ }
569
+
559
570
  /**
560
571
  * Synchronous stat(2) - Get file status.
561
572
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
562
573
  */
563
- export function statSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
564
- export function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
565
- export function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
574
+ export const statSync: StatSyncFn;
566
575
 
567
576
  /**
568
577
  * Asynchronous fstat(2) - Get file status.
@@ -588,9 +597,7 @@ declare module 'fs' {
588
597
  * Synchronous fstat(2) - Get file status.
589
598
  * @param fd A file descriptor.
590
599
  */
591
- export function fstatSync(fd: number, options?: StatOptions & { bigint?: false }): Stats;
592
- export function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
593
- export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
600
+ export const fstatSync: StatSyncFn<number>;
594
601
 
595
602
  /**
596
603
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
@@ -616,10 +623,7 @@ declare module 'fs' {
616
623
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
617
624
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
618
625
  */
619
- export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
620
- export function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
621
- export function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
622
-
626
+ export const lstatSync: StatSyncFn;
623
627
  /**
624
628
  * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
625
629
  * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1561,7 +1565,11 @@ declare module 'fs' {
1561
1565
  * @param options An object that may contain an optional flag.
1562
1566
  * If a flag is not provided, it defaults to `'r'`.
1563
1567
  */
1564
- export function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
1568
+ export function readFile(
1569
+ path: PathLike | number,
1570
+ options: { encoding?: null; flag?: string; } & Abortable | undefined | null,
1571
+ callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
1572
+ ): void;
1565
1573
 
1566
1574
  /**
1567
1575
  * Asynchronously reads the entire contents of a file.
@@ -1571,7 +1579,11 @@ declare module 'fs' {
1571
1579
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1572
1580
  * If a flag is not provided, it defaults to `'r'`.
1573
1581
  */
1574
- export function readFile(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
1582
+ export function readFile(
1583
+ path: PathLike | number,
1584
+ options: { encoding: BufferEncoding; flag?: string; } & Abortable | string,
1585
+ callback: (err: NodeJS.ErrnoException | null, data: string) => void,
1586
+ ): void;
1575
1587
 
1576
1588
  /**
1577
1589
  * Asynchronously reads the entire contents of a file.
@@ -1583,7 +1595,8 @@ declare module 'fs' {
1583
1595
  */
1584
1596
  export function readFile(
1585
1597
  path: PathLike | number,
1586
- options: BaseEncodingOptions & { flag?: string; } | string | undefined | null,
1598
+ // TODO: unify the options across all readfile functions
1599
+ options: BaseEncodingOptions & { flag?: string; } & Abortable | string | undefined | null,
1587
1600
  callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
1588
1601
  ): void;
1589
1602
 
@@ -1655,7 +1668,7 @@ declare module 'fs' {
1655
1668
  */
1656
1669
  export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | BufferEncoding | null): string | Buffer;
1657
1670
 
1658
- export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode; flag?: string; } | string | null;
1671
+ export type WriteFileOptions = (BaseEncodingOptions & Abortable & { mode?: Mode; flag?: string; }) | string | null;
1659
1672
 
1660
1673
  /**
1661
1674
  * Asynchronously writes data to a file, replacing the file if it already exists.
@@ -2257,5 +2270,6 @@ declare module 'fs' {
2257
2270
 
2258
2271
  export interface StatOptions {
2259
2272
  bigint?: boolean;
2273
+ throwIfNoEntry?: boolean;
2260
2274
  }
2261
2275
  }
node/http.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- declare module 'node:http' {
2
- export * from 'http';
3
- }
4
-
5
1
  declare module 'http' {
6
- import * as stream from 'node:stream';
7
- import { URL } from 'node:url';
8
- import { Socket, Server as NetServer } from 'node:net';
2
+ import * as stream from 'stream';
3
+ import { URL } from 'url';
4
+ import { Socket, Server as NetServer } from 'net';
9
5
 
10
6
  // incoming headers will never contain number
11
7
  interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
@@ -81,6 +77,7 @@ declare module 'http' {
81
77
  }
82
78
 
83
79
  interface ClientRequestArgs {
80
+ abort?: AbortSignal;
84
81
  protocol?: string | null;
85
82
  host?: string | null;
86
83
  hostname?: string | null;
node/http2.d.ts CHANGED
@@ -1,22 +1,18 @@
1
- declare module 'node:http2' {
2
- export * from 'http2';
3
- }
4
-
5
1
  declare module 'http2' {
6
- import EventEmitter = require('node:events');
7
- import * as fs from 'node:fs';
8
- import * as net from 'node:net';
9
- import * as stream from 'node:stream';
10
- import * as tls from 'node:tls';
11
- import * as url from 'node:url';
2
+ import EventEmitter = require('events');
3
+ import * as fs from 'fs';
4
+ import * as net from 'net';
5
+ import * as stream from 'stream';
6
+ import * as tls from 'tls';
7
+ import * as url from 'url';
12
8
 
13
9
  import {
14
10
  IncomingHttpHeaders as Http1IncomingHttpHeaders,
15
11
  OutgoingHttpHeaders,
16
12
  IncomingMessage,
17
13
  ServerResponse,
18
- } from 'node:http';
19
- export { OutgoingHttpHeaders } from 'node:http';
14
+ } from 'http';
15
+ export { OutgoingHttpHeaders } from 'http';
20
16
 
21
17
  export interface IncomingHttpStatusHeader {
22
18
  ":status"?: number;
@@ -470,7 +466,16 @@ declare module 'http2' {
470
466
  origins?: string[];
471
467
  }
472
468
 
473
- export interface Http2Server extends net.Server {
469
+ interface HTTP2ServerCommon {
470
+ setTimeout(msec?: number, callback?: () => void): this;
471
+ /**
472
+ * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
473
+ * Throws ERR_INVALID_ARG_TYPE for invalid settings argument.
474
+ */
475
+ updateSettings(settings: Settings): void;
476
+ }
477
+
478
+ export interface Http2Server extends net.Server, HTTP2ServerCommon {
474
479
  addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
475
480
  addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
476
481
  addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
@@ -518,11 +523,9 @@ declare module 'http2' {
518
523
  prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
519
524
  prependOnceListener(event: "timeout", listener: () => void): this;
520
525
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
521
-
522
- setTimeout(msec?: number, callback?: () => void): this;
523
526
  }
524
527
 
525
- export interface Http2SecureServer extends tls.Server {
528
+ export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
526
529
  addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
527
530
  addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
528
531
  addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
@@ -576,8 +579,6 @@ declare module 'http2' {
576
579
  prependOnceListener(event: "timeout", listener: () => void): this;
577
580
  prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
578
581
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
579
-
580
- setTimeout(msec?: number, callback?: () => void): this;
581
582
  }
582
583
 
583
584
  export class Http2ServerRequest extends stream.Readable {
node/https.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- declare module 'node:https' {
2
- export * from 'https';
3
- }
4
-
5
1
  declare module 'https' {
6
- import * as tls from 'node:tls';
7
- import * as http from 'node:http';
8
- import { URL } from 'node:url';
2
+ import * as tls from 'tls';
3
+ import * as http from 'http';
4
+ import { URL } from 'url';
9
5
 
10
6
  type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
11
7
 
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 15.0
1
+ // Type definitions for non-npm package Node.js 15.3
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -6,7 +6,6 @@
6
6
  // Alvis HT Tang <https://github.com/alvis>
7
7
  // Andrew Makarov <https://github.com/r3nya>
8
8
  // Benjamin Toueg <https://github.com/btoueg>
9
- // Bruno Scheufler <https://github.com/brunoscheufler>
10
9
  // Chigozirim C. <https://github.com/smac89>
11
10
  // David Junger <https://github.com/touffy>
12
11
  // Deividas Bakanas <https://github.com/DeividasBakanas>
node/inspector.d.ts CHANGED
@@ -7,18 +7,11 @@
7
7
 
8
8
  // tslint:disable:max-line-length
9
9
 
10
- /**
11
- * The inspector module provides an API for interacting with the V8 inspector.
12
- */
13
- declare module 'node:inspector' {
14
- export * from 'inspector';
15
- }
16
-
17
10
  /**
18
11
  * The inspector module provides an API for interacting with the V8 inspector.
19
12
  */
20
13
  declare module 'inspector' {
21
- import EventEmitter = require('node:events');
14
+ import EventEmitter = require('events');
22
15
 
23
16
  interface InspectorNotification<T> {
24
17
  method: string;