@types/node 22.6.2 → 22.7.1
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 +1 -1
- node/buffer.d.ts +12 -5
- node/diagnostics_channel.d.ts +4 -4
- node/inspector.d.ts +67 -0
- node/net.d.ts +9 -13
- node/package.json +2 -2
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (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: Wed, 25 Sep 2024
|
11
|
+
* Last updated: Wed, 25 Sep 2024 17:36:54 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/buffer.d.ts
CHANGED
@@ -261,6 +261,13 @@ declare module "buffer" {
|
|
261
261
|
| {
|
262
262
|
valueOf(): T;
|
263
263
|
};
|
264
|
+
// `WithArrayBufferLike` is a backwards-compatible workaround for the addition of a `TArrayBuffer` type parameter to
|
265
|
+
// `Uint8Array` to ensure that `Buffer` remains assignment-compatible with `Uint8Array`, but without the added
|
266
|
+
// complexity involved with making `Buffer` itself generic as that would require re-introducing `"typesVersions"` to
|
267
|
+
// the NodeJS types. It is likely this interface will become deprecated in the future once `Buffer` does become generic.
|
268
|
+
interface WithArrayBufferLike<TArrayBuffer extends ArrayBufferLike> {
|
269
|
+
readonly buffer: TArrayBuffer;
|
270
|
+
}
|
264
271
|
/**
|
265
272
|
* Raw data is stored in instances of the Buffer class.
|
266
273
|
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
@@ -912,7 +919,7 @@ declare module "buffer" {
|
|
912
919
|
* @param [start=0] Where the new `Buffer` will start.
|
913
920
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
914
921
|
*/
|
915
|
-
slice(start?: number, end?: number): Buffer
|
922
|
+
slice(start?: number, end?: number): Buffer & WithArrayBufferLike<ArrayBuffer>;
|
916
923
|
/**
|
917
924
|
* Returns a new `Buffer` that references the same memory as the original, but
|
918
925
|
* offset and cropped by the `start` and `end` indices.
|
@@ -972,7 +979,7 @@ declare module "buffer" {
|
|
972
979
|
* @param [start=0] Where the new `Buffer` will start.
|
973
980
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
974
981
|
*/
|
975
|
-
subarray(start?: number, end?: number): Buffer
|
982
|
+
subarray(start?: number, end?: number): Buffer & WithArrayBufferLike<this["buffer"]>;
|
976
983
|
/**
|
977
984
|
* Writes `value` to `buf` at the specified `offset` as big-endian.
|
978
985
|
*
|
@@ -1630,7 +1637,7 @@ declare module "buffer" {
|
|
1630
1637
|
* @since v5.10.0
|
1631
1638
|
* @return A reference to `buf`.
|
1632
1639
|
*/
|
1633
|
-
swap16():
|
1640
|
+
swap16(): this;
|
1634
1641
|
/**
|
1635
1642
|
* Interprets `buf` as an array of unsigned 32-bit integers and swaps the
|
1636
1643
|
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
|
@@ -1656,7 +1663,7 @@ declare module "buffer" {
|
|
1656
1663
|
* @since v5.10.0
|
1657
1664
|
* @return A reference to `buf`.
|
1658
1665
|
*/
|
1659
|
-
swap32():
|
1666
|
+
swap32(): this;
|
1660
1667
|
/**
|
1661
1668
|
* Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
|
1662
1669
|
* Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
|
@@ -1682,7 +1689,7 @@ declare module "buffer" {
|
|
1682
1689
|
* @since v6.3.0
|
1683
1690
|
* @return A reference to `buf`.
|
1684
1691
|
*/
|
1685
|
-
swap64():
|
1692
|
+
swap64(): this;
|
1686
1693
|
/**
|
1687
1694
|
* Writes `value` to `buf` at the specified `offset`. `value` must be a
|
1688
1695
|
* valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
|
node/diagnostics_channel.d.ts
CHANGED
@@ -540,11 +540,11 @@ declare module "diagnostics_channel" {
|
|
540
540
|
* @param args Optional arguments to pass to the function
|
541
541
|
* @return The return value of the given function
|
542
542
|
*/
|
543
|
-
traceCallback<Fn extends (this: any, ...args: any) => any>(
|
543
|
+
traceCallback<Fn extends (this: any, ...args: any[]) => any>(
|
544
544
|
fn: Fn,
|
545
|
-
position
|
546
|
-
context
|
547
|
-
thisArg
|
545
|
+
position?: number,
|
546
|
+
context?: ContextType,
|
547
|
+
thisArg?: any,
|
548
548
|
...args: Parameters<Fn>
|
549
549
|
): void;
|
550
550
|
}
|
node/inspector.d.ts
CHANGED
@@ -1704,6 +1704,10 @@ declare module 'inspector' {
|
|
1704
1704
|
}
|
1705
1705
|
}
|
1706
1706
|
namespace Network {
|
1707
|
+
/**
|
1708
|
+
* Resource type as it was perceived by the rendering engine.
|
1709
|
+
*/
|
1710
|
+
type ResourceType = string;
|
1707
1711
|
/**
|
1708
1712
|
* Unique request identifier.
|
1709
1713
|
*/
|
@@ -1722,6 +1726,21 @@ declare module 'inspector' {
|
|
1722
1726
|
interface Request {
|
1723
1727
|
url: string;
|
1724
1728
|
method: string;
|
1729
|
+
headers: Headers;
|
1730
|
+
}
|
1731
|
+
/**
|
1732
|
+
* HTTP response data.
|
1733
|
+
*/
|
1734
|
+
interface Response {
|
1735
|
+
url: string;
|
1736
|
+
status: number;
|
1737
|
+
statusText: string;
|
1738
|
+
headers: Headers;
|
1739
|
+
}
|
1740
|
+
/**
|
1741
|
+
* Request / response headers as keys / values of JSON object.
|
1742
|
+
*/
|
1743
|
+
interface Headers {
|
1725
1744
|
}
|
1726
1745
|
interface RequestWillBeSentEventDataType {
|
1727
1746
|
/**
|
@@ -1750,6 +1769,32 @@ declare module 'inspector' {
|
|
1750
1769
|
* Timestamp.
|
1751
1770
|
*/
|
1752
1771
|
timestamp: MonotonicTime;
|
1772
|
+
/**
|
1773
|
+
* Resource type.
|
1774
|
+
*/
|
1775
|
+
type: ResourceType;
|
1776
|
+
/**
|
1777
|
+
* Response data.
|
1778
|
+
*/
|
1779
|
+
response: Response;
|
1780
|
+
}
|
1781
|
+
interface LoadingFailedEventDataType {
|
1782
|
+
/**
|
1783
|
+
* Request identifier.
|
1784
|
+
*/
|
1785
|
+
requestId: RequestId;
|
1786
|
+
/**
|
1787
|
+
* Timestamp.
|
1788
|
+
*/
|
1789
|
+
timestamp: MonotonicTime;
|
1790
|
+
/**
|
1791
|
+
* Resource type.
|
1792
|
+
*/
|
1793
|
+
type: ResourceType;
|
1794
|
+
/**
|
1795
|
+
* Error message.
|
1796
|
+
*/
|
1797
|
+
errorText: string;
|
1753
1798
|
}
|
1754
1799
|
interface LoadingFinishedEventDataType {
|
1755
1800
|
/**
|
@@ -2260,6 +2305,7 @@ declare module 'inspector' {
|
|
2260
2305
|
* Fired when HTTP response is available.
|
2261
2306
|
*/
|
2262
2307
|
addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2308
|
+
addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
2263
2309
|
addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2264
2310
|
/**
|
2265
2311
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -2302,6 +2348,7 @@ declare module 'inspector' {
|
|
2302
2348
|
emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
|
2303
2349
|
emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
|
2304
2350
|
emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
|
2351
|
+
emit(event: 'Network.loadingFailed', message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
|
2305
2352
|
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
|
2306
2353
|
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
|
2307
2354
|
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
|
@@ -2408,6 +2455,7 @@ declare module 'inspector' {
|
|
2408
2455
|
* Fired when HTTP response is available.
|
2409
2456
|
*/
|
2410
2457
|
on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2458
|
+
on(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
2411
2459
|
on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2412
2460
|
/**
|
2413
2461
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -2524,6 +2572,7 @@ declare module 'inspector' {
|
|
2524
2572
|
* Fired when HTTP response is available.
|
2525
2573
|
*/
|
2526
2574
|
once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2575
|
+
once(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
2527
2576
|
once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2528
2577
|
/**
|
2529
2578
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -2640,6 +2689,7 @@ declare module 'inspector' {
|
|
2640
2689
|
* Fired when HTTP response is available.
|
2641
2690
|
*/
|
2642
2691
|
prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2692
|
+
prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
2643
2693
|
prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2644
2694
|
/**
|
2645
2695
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -2756,6 +2806,7 @@ declare module 'inspector' {
|
|
2756
2806
|
* Fired when HTTP response is available.
|
2757
2807
|
*/
|
2758
2808
|
prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2809
|
+
prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
2759
2810
|
prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2760
2811
|
/**
|
2761
2812
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -2853,6 +2904,7 @@ declare module 'inspector' {
|
|
2853
2904
|
*/
|
2854
2905
|
const console: InspectorConsole;
|
2855
2906
|
|
2907
|
+
// DevTools protocol event broadcast methods
|
2856
2908
|
namespace Network {
|
2857
2909
|
/**
|
2858
2910
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
@@ -2881,6 +2933,15 @@ declare module 'inspector' {
|
|
2881
2933
|
* @experimental
|
2882
2934
|
*/
|
2883
2935
|
function loadingFinished(params: LoadingFinishedEventDataType): void;
|
2936
|
+
/**
|
2937
|
+
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
2938
|
+
*
|
2939
|
+
* Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that
|
2940
|
+
* HTTP request has failed to load.
|
2941
|
+
* @since v22.7.0
|
2942
|
+
* @experimental
|
2943
|
+
*/
|
2944
|
+
function loadingFailed(params: LoadingFailedEventDataType): void;
|
2884
2945
|
}
|
2885
2946
|
}
|
2886
2947
|
|
@@ -3357,6 +3418,7 @@ declare module 'inspector/promises' {
|
|
3357
3418
|
* Fired when HTTP response is available.
|
3358
3419
|
*/
|
3359
3420
|
addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3421
|
+
addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
3360
3422
|
addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3361
3423
|
/**
|
3362
3424
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -3399,6 +3461,7 @@ declare module 'inspector/promises' {
|
|
3399
3461
|
emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
|
3400
3462
|
emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
|
3401
3463
|
emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
|
3464
|
+
emit(event: 'Network.loadingFailed', message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
|
3402
3465
|
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
|
3403
3466
|
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
|
3404
3467
|
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
|
@@ -3505,6 +3568,7 @@ declare module 'inspector/promises' {
|
|
3505
3568
|
* Fired when HTTP response is available.
|
3506
3569
|
*/
|
3507
3570
|
on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3571
|
+
on(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
3508
3572
|
on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3509
3573
|
/**
|
3510
3574
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -3621,6 +3685,7 @@ declare module 'inspector/promises' {
|
|
3621
3685
|
* Fired when HTTP response is available.
|
3622
3686
|
*/
|
3623
3687
|
once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3688
|
+
once(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
3624
3689
|
once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3625
3690
|
/**
|
3626
3691
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -3737,6 +3802,7 @@ declare module 'inspector/promises' {
|
|
3737
3802
|
* Fired when HTTP response is available.
|
3738
3803
|
*/
|
3739
3804
|
prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3805
|
+
prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
3740
3806
|
prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3741
3807
|
/**
|
3742
3808
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
@@ -3853,6 +3919,7 @@ declare module 'inspector/promises' {
|
|
3853
3919
|
* Fired when HTTP response is available.
|
3854
3920
|
*/
|
3855
3921
|
prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3922
|
+
prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
|
3856
3923
|
prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3857
3924
|
/**
|
3858
3925
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
node/net.d.ts
CHANGED
@@ -29,6 +29,7 @@ declare module "net" {
|
|
29
29
|
interface SocketConstructorOpts {
|
30
30
|
fd?: number | undefined;
|
31
31
|
allowHalfOpen?: boolean | undefined;
|
32
|
+
onread?: OnReadOpts | undefined;
|
32
33
|
readable?: boolean | undefined;
|
33
34
|
writable?: boolean | undefined;
|
34
35
|
signal?: AbortSignal;
|
@@ -37,20 +38,15 @@ declare module "net" {
|
|
37
38
|
buffer: Uint8Array | (() => Uint8Array);
|
38
39
|
/**
|
39
40
|
* This function is called for every chunk of incoming data.
|
40
|
-
* Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer
|
41
|
-
* Return false from this function to implicitly pause() the socket.
|
41
|
+
* Two arguments are passed to it: the number of bytes written to `buffer` and a reference to `buffer`.
|
42
|
+
* Return `false` from this function to implicitly `pause()` the socket.
|
42
43
|
*/
|
43
|
-
callback(bytesWritten: number,
|
44
|
-
}
|
45
|
-
interface ConnectOpts {
|
46
|
-
/**
|
47
|
-
* If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
|
48
|
-
* Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
|
49
|
-
* still be emitted as normal and methods like pause() and resume() will also behave as expected.
|
50
|
-
*/
|
51
|
-
onread?: OnReadOpts | undefined;
|
44
|
+
callback(bytesWritten: number, buffer: Uint8Array): boolean;
|
52
45
|
}
|
53
|
-
|
46
|
+
// TODO: remove empty ConnectOpts placeholder at next major @types/node version.
|
47
|
+
/** @deprecated */
|
48
|
+
interface ConnectOpts {}
|
49
|
+
interface TcpSocketConnectOpts {
|
54
50
|
port: number;
|
55
51
|
host?: string | undefined;
|
56
52
|
localAddress?: string | undefined;
|
@@ -70,7 +66,7 @@ declare module "net" {
|
|
70
66
|
*/
|
71
67
|
autoSelectFamilyAttemptTimeout?: number | undefined;
|
72
68
|
}
|
73
|
-
interface IpcSocketConnectOpts
|
69
|
+
interface IpcSocketConnectOpts {
|
74
70
|
path: string;
|
75
71
|
}
|
76
72
|
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.
|
3
|
+
"version": "22.7.1",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -212,6 +212,6 @@
|
|
212
212
|
"dependencies": {
|
213
213
|
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "6eac2c2113a7d5f58f871a8766de0fec4c086f9b704d46c70434588cb5f8b35d",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|