@@ -25,3 +25,34 @@ interface ArrayBuffer {
2525 */
2626 transferToFixedLength ( newByteLength ?: number ) : ArrayBuffer ;
2727}
28+
29+ // Type compatibility hack for AllowSharedBufferSource in TypeScript < 5.9
30+ interface SharedArrayBuffer {
31+ readonly resizable : boolean ;
32+
33+ readonly detached : boolean ;
34+
35+ /**
36+ * Creates a new `ArrayBuffer` with the same byte content as this buffer, then detaches this buffer.
37+ * @param newByteLength - If provided, specifies the `byteLength` of the new `ArrayBuffer`
38+ * @throws RangeError If this `ArrayBuffer` is resizable and newByteLength is greater than the `maxByteLength` of this `ArrayBuffer`
39+ * @throws TypeError If this `ArrayBuffer` is already detached, or if it can only be detached by designated operations
40+ * @returns A new `ArrayBuffer` object
41+ */
42+ transfer ( newByteLength ?: number ) : ArrayBuffer ;
43+
44+ /**
45+ * Creates a new non-resizable `ArrayBuffer` with the same byte content as this buffer, then detaches this buffer.
46+ * @param newByteLength - If provided, specifies the `byteLength` of the new `ArrayBuffer`
47+ * @throws TypeError If this `ArrayBuffer` is already detached, or if it can only be detached by designated operations
48+ * @returns A new `ArrayBuffer` object
49+ */
50+ transferToFixedLength ( newByteLength ?: number ) : ArrayBuffer ;
51+
52+ /**
53+ * Resizes the ArrayBuffer to the specified size (in bytes).
54+ *
55+ * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/resize)
56+ */
57+ resize ( newByteLength ?: number ) : void ;
58+ }
0 commit comments