@types/node 18.11.2 → 18.11.4

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 (https://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: Tue, 18 Oct 2022 22:03:06 GMT
11
+ * Last updated: Sun, 23 Oct 2022 19:32:39 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/assert.d.ts CHANGED
@@ -65,6 +65,27 @@ declare module 'assert' {
65
65
  */
66
66
  calls(exact?: number): () => void;
67
67
  calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
68
+ /**
69
+ * Example:
70
+ *
71
+ * ```js
72
+ * import assert from 'node:assert';
73
+ *
74
+ * const tracker = new assert.CallTracker();
75
+ *
76
+ * function func() {}
77
+ * const callsfunc = tracker.calls(func);
78
+ * callsfunc(1, 2, 3);
79
+ *
80
+ * assert.deepStrictEqual(tracker.getCalls(callsfunc),
81
+ * [{ thisArg: this, arguments: [1, 2, 3 ] }]);
82
+ * ```
83
+ *
84
+ * @since v18.8.0, v16.18.0
85
+ * @params fn
86
+ * @returns An Array with the calls to a tracked function.
87
+ */
88
+ getCalls(fn: Function): CallTrackerCall[];
68
89
  /**
69
90
  * The arrays contains information about the expected and actual number of calls of
70
91
  * the functions that have not been called the expected number of times.
@@ -100,6 +121,31 @@ declare module 'assert' {
100
121
  * @return of objects containing information about the wrapper functions returned by `calls`.
101
122
  */
102
123
  report(): CallTrackerReportInformation[];
124
+ /**
125
+ * Reset calls of the call tracker.
126
+ * If a tracked function is passed as an argument, the calls will be reset for it.
127
+ * If no arguments are passed, all tracked functions will be reset.
128
+ *
129
+ * ```js
130
+ * import assert from 'node:assert';
131
+ *
132
+ * const tracker = new assert.CallTracker();
133
+ *
134
+ * function func() {}
135
+ * const callsfunc = tracker.calls(func);
136
+ *
137
+ * callsfunc();
138
+ * // Tracker was called once
139
+ * tracker.getCalls(callsfunc).length === 1;
140
+ *
141
+ * tracker.reset(callsfunc);
142
+ * tracker.getCalls(callsfunc).length === 0;
143
+ * ```
144
+ *
145
+ * @since v18.8.0, v16.18.0
146
+ * @param fn a tracked function to reset.
147
+ */
148
+ reset(fn?: Function): void;
103
149
  /**
104
150
  * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
105
151
  * have not been called the expected number of times.
@@ -125,6 +171,10 @@ declare module 'assert' {
125
171
  */
126
172
  verify(): void;
127
173
  }
174
+ interface CallTrackerCall {
175
+ thisArg: object;
176
+ arguments: unknown[];
177
+ }
128
178
  interface CallTrackerReportInformation {
129
179
  message: string;
130
180
  /** The actual number of times the function was called. */
node/crypto.d.ts CHANGED
@@ -1830,7 +1830,7 @@ declare module 'crypto' {
1830
1830
  * Return a random integer `n` such that `min <= n < max`. This
1831
1831
  * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
1832
1832
  *
1833
- * The range (`max - min`) must be less than 248. `min` and `max` must
1833
+ * The range (`max - min`) must be less than 2^48. `min` and `max` must
1834
1834
  * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
1835
1835
  *
1836
1836
  * If the `callback` function is not provided, the random integer is
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.11.2",
3
+ "version": "18.11.4",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "d7bbee366053005eb9ad76ecf711181a2633097e3afe20ba0ac3309f73d09afc",
230
+ "typesPublisherContentHash": "510d7c55520137d9fd93e59476c958bf0749bee7c3f256c58974e635d2dcbfc4",
231
231
  "typeScriptVersion": "4.1"
232
232
  }
node/ts4.8/assert.d.ts CHANGED
@@ -65,6 +65,27 @@ declare module 'assert' {
65
65
  */
66
66
  calls(exact?: number): () => void;
67
67
  calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
68
+ /**
69
+ * Example:
70
+ *
71
+ * ```js
72
+ * import assert from 'node:assert';
73
+ *
74
+ * const tracker = new assert.CallTracker();
75
+ *
76
+ * function func() {}
77
+ * const callsfunc = tracker.calls(func);
78
+ * callsfunc(1, 2, 3);
79
+ *
80
+ * assert.deepStrictEqual(tracker.getCalls(callsfunc),
81
+ * [{ thisArg: this, arguments: [1, 2, 3 ] }]);
82
+ * ```
83
+ *
84
+ * @since v18.8.0, v16.18.0
85
+ * @params fn
86
+ * @returns An Array with the calls to a tracked function.
87
+ */
88
+ getCalls(fn: Function): CallTrackerCall[];
68
89
  /**
69
90
  * The arrays contains information about the expected and actual number of calls of
70
91
  * the functions that have not been called the expected number of times.
@@ -100,6 +121,31 @@ declare module 'assert' {
100
121
  * @return of objects containing information about the wrapper functions returned by `calls`.
101
122
  */
102
123
  report(): CallTrackerReportInformation[];
124
+ /**
125
+ * Reset calls of the call tracker.
126
+ * If a tracked function is passed as an argument, the calls will be reset for it.
127
+ * If no arguments are passed, all tracked functions will be reset.
128
+ *
129
+ * ```js
130
+ * import assert from 'node:assert';
131
+ *
132
+ * const tracker = new assert.CallTracker();
133
+ *
134
+ * function func() {}
135
+ * const callsfunc = tracker.calls(func);
136
+ *
137
+ * callsfunc();
138
+ * // Tracker was called once
139
+ * tracker.getCalls(callsfunc).length === 1;
140
+ *
141
+ * tracker.reset(callsfunc);
142
+ * tracker.getCalls(callsfunc).length === 0;
143
+ * ```
144
+ *
145
+ * @since v18.8.0, v16.18.0
146
+ * @param fn a tracked function to reset.
147
+ */
148
+ reset(fn?: Function): void;
103
149
  /**
104
150
  * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
105
151
  * have not been called the expected number of times.
@@ -125,6 +171,10 @@ declare module 'assert' {
125
171
  */
126
172
  verify(): void;
127
173
  }
174
+ interface CallTrackerCall {
175
+ thisArg: object;
176
+ arguments: unknown[];
177
+ }
128
178
  interface CallTrackerReportInformation {
129
179
  message: string;
130
180
  /** The actual number of times the function was called. */
node/ts4.8/crypto.d.ts CHANGED
@@ -1830,7 +1830,7 @@ declare module 'crypto' {
1830
1830
  * Return a random integer `n` such that `min <= n < max`. This
1831
1831
  * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
1832
1832
  *
1833
- * The range (`max - min`) must be less than 248. `min` and `max` must
1833
+ * The range (`max - min`) must be less than 2^48. `min` and `max` must
1834
1834
  * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
1835
1835
  *
1836
1836
  * If the `callback` function is not provided, the random integer is