@types/node 16.18.109 → 16.18.110

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 v16.18/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/v16.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 25 Sep 2024 00:29:50 GMT
11
+ * Last updated: Wed, 25 Sep 2024 17:36:54 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
node v16.18/buffer.d.ts CHANGED
@@ -188,6 +188,13 @@ declare module "buffer" {
188
188
  | {
189
189
  valueOf(): T;
190
190
  };
191
+ // `WithArrayBufferLike` is a backwards-compatible workaround for the addition of a `TArrayBuffer` type parameter to
192
+ // `Uint8Array` to ensure that `Buffer` remains assignment-compatible with `Uint8Array`, but without the added
193
+ // complexity involved with making `Buffer` itself generic as that would require re-introducing `"typesVersions"` to
194
+ // the NodeJS types. It is likely this interface will become deprecated in the future once `Buffer` does become generic.
195
+ interface WithArrayBufferLike<TArrayBuffer extends ArrayBufferLike> {
196
+ readonly buffer: TArrayBuffer;
197
+ }
191
198
  /**
192
199
  * Raw data is stored in instances of the Buffer class.
193
200
  * 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.
@@ -819,7 +826,7 @@ declare module "buffer" {
819
826
  * @param [start=0] Where the new `Buffer` will start.
820
827
  * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
821
828
  */
822
- slice(start?: number, end?: number): Buffer;
829
+ slice(start?: number, end?: number): Buffer & WithArrayBufferLike<ArrayBuffer>;
823
830
  /**
824
831
  * Returns a new `Buffer` that references the same memory as the original, but
825
832
  * offset and cropped by the `start` and `end` indices.
@@ -879,7 +886,7 @@ declare module "buffer" {
879
886
  * @param [start=0] Where the new `Buffer` will start.
880
887
  * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
881
888
  */
882
- subarray(start?: number, end?: number): Buffer;
889
+ subarray(start?: number, end?: number): Buffer & WithArrayBufferLike<this["buffer"]>;
883
890
  /**
884
891
  * Writes `value` to `buf` at the specified `offset` as big-endian.
885
892
  *
@@ -1537,7 +1544,7 @@ declare module "buffer" {
1537
1544
  * @since v5.10.0
1538
1545
  * @return A reference to `buf`.
1539
1546
  */
1540
- swap16(): Buffer;
1547
+ swap16(): this;
1541
1548
  /**
1542
1549
  * Interprets `buf` as an array of unsigned 32-bit integers and swaps the
1543
1550
  * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
@@ -1563,7 +1570,7 @@ declare module "buffer" {
1563
1570
  * @since v5.10.0
1564
1571
  * @return A reference to `buf`.
1565
1572
  */
1566
- swap32(): Buffer;
1573
+ swap32(): this;
1567
1574
  /**
1568
1575
  * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
1569
1576
  * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
@@ -1589,7 +1596,7 @@ declare module "buffer" {
1589
1596
  * @since v6.3.0
1590
1597
  * @return A reference to `buf`.
1591
1598
  */
1592
- swap64(): Buffer;
1599
+ swap64(): this;
1593
1600
  /**
1594
1601
  * Writes `value` to `buf` at the specified `offset`. `value` must be a
1595
1602
  * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.109",
3
+ "version": "16.18.110",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -210,6 +210,6 @@
210
210
  },
211
211
  "scripts": {},
212
212
  "dependencies": {},
213
- "typesPublisherContentHash": "f7aeca3a5c126e5fe0326f911445d3f32dec22f907b425be2e2cd6a672fa47c4",
213
+ "typesPublisherContentHash": "0d691889c6bd85ef024ca5b209d46b2aaa88c7dd918ac667cd6f508ac8a35f9d",
214
214
  "typeScriptVersion": "4.8"
215
215
  }