@@ -1406,6 +1406,14 @@ interface ArrayBuffer {
1406
1406
slice(begin: number, end?: number): ArrayBuffer;
1407
1407
}
1408
1408
1409
+ /**
1410
+ * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays.
1411
+ */
1412
+ interface ArrayBufferTypes {
1413
+ ArrayBuffer: ArrayBuffer;
1414
+ }
1415
+ type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes];
1416
+
1409
1417
interface ArrayBufferConstructor {
1410
1418
readonly prototype: ArrayBuffer;
1411
1419
new (byteLength: number): ArrayBuffer;
@@ -1417,7 +1425,7 @@ interface ArrayBufferView {
1417
1425
/**
1418
1426
* The ArrayBuffer instance referenced by the array.
1419
1427
*/
1420
- buffer: ArrayBuffer ;
1428
+ buffer: ArrayBufferLike ;
1421
1429
1422
1430
/**
1423
1431
* The length in bytes of the array.
@@ -1559,7 +1567,7 @@ interface DataView {
1559
1567
}
1560
1568
1561
1569
interface DataViewConstructor {
1562
- new (buffer: ArrayBuffer , byteOffset?: number, byteLength?: number): DataView;
1570
+ new (buffer: ArrayBufferLike , byteOffset?: number, byteLength?: number): DataView;
1563
1571
}
1564
1572
declare const DataView: DataViewConstructor;
1565
1573
@@ -1576,7 +1584,7 @@ interface Int8Array {
1576
1584
/**
1577
1585
* The ArrayBuffer instance referenced by the array.
1578
1586
*/
1579
- readonly buffer: ArrayBuffer ;
1587
+ readonly buffer: ArrayBufferLike ;
1580
1588
1581
1589
/**
1582
1590
* The length in bytes of the array.
@@ -1819,7 +1827,7 @@ interface Int8ArrayConstructor {
1819
1827
readonly prototype: Int8Array;
1820
1828
new (length: number): Int8Array;
1821
1829
new (array: ArrayLike<number>): Int8Array;
1822
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Int8Array;
1830
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Int8Array;
1823
1831
1824
1832
/**
1825
1833
* The size in bytes of each element in the array.
@@ -1860,7 +1868,7 @@ interface Uint8Array {
1860
1868
/**
1861
1869
* The ArrayBuffer instance referenced by the array.
1862
1870
*/
1863
- readonly buffer: ArrayBuffer ;
1871
+ readonly buffer: ArrayBufferLike ;
1864
1872
1865
1873
/**
1866
1874
* The length in bytes of the array.
@@ -2104,7 +2112,7 @@ interface Uint8ArrayConstructor {
2104
2112
readonly prototype: Uint8Array;
2105
2113
new (length: number): Uint8Array;
2106
2114
new (array: ArrayLike<number>): Uint8Array;
2107
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Uint8Array;
2115
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Uint8Array;
2108
2116
2109
2117
/**
2110
2118
* The size in bytes of each element in the array.
@@ -2145,7 +2153,7 @@ interface Uint8ClampedArray {
2145
2153
/**
2146
2154
* The ArrayBuffer instance referenced by the array.
2147
2155
*/
2148
- readonly buffer: ArrayBuffer ;
2156
+ readonly buffer: ArrayBufferLike ;
2149
2157
2150
2158
/**
2151
2159
* The length in bytes of the array.
@@ -2389,7 +2397,7 @@ interface Uint8ClampedArrayConstructor {
2389
2397
readonly prototype: Uint8ClampedArray;
2390
2398
new (length: number): Uint8ClampedArray;
2391
2399
new (array: ArrayLike<number>): Uint8ClampedArray;
2392
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Uint8ClampedArray;
2400
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Uint8ClampedArray;
2393
2401
2394
2402
/**
2395
2403
* The size in bytes of each element in the array.
@@ -2429,7 +2437,7 @@ interface Int16Array {
2429
2437
/**
2430
2438
* The ArrayBuffer instance referenced by the array.
2431
2439
*/
2432
- readonly buffer: ArrayBuffer ;
2440
+ readonly buffer: ArrayBufferLike ;
2433
2441
2434
2442
/**
2435
2443
* The length in bytes of the array.
@@ -2673,7 +2681,7 @@ interface Int16ArrayConstructor {
2673
2681
readonly prototype: Int16Array;
2674
2682
new (length: number): Int16Array;
2675
2683
new (array: ArrayLike<number>): Int16Array;
2676
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Int16Array;
2684
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Int16Array;
2677
2685
2678
2686
/**
2679
2687
* The size in bytes of each element in the array.
@@ -2714,7 +2722,7 @@ interface Uint16Array {
2714
2722
/**
2715
2723
* The ArrayBuffer instance referenced by the array.
2716
2724
*/
2717
- readonly buffer: ArrayBuffer ;
2725
+ readonly buffer: ArrayBufferLike ;
2718
2726
2719
2727
/**
2720
2728
* The length in bytes of the array.
@@ -2958,7 +2966,7 @@ interface Uint16ArrayConstructor {
2958
2966
readonly prototype: Uint16Array;
2959
2967
new (length: number): Uint16Array;
2960
2968
new (array: ArrayLike<number>): Uint16Array;
2961
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Uint16Array;
2969
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Uint16Array;
2962
2970
2963
2971
/**
2964
2972
* The size in bytes of each element in the array.
@@ -2998,7 +3006,7 @@ interface Int32Array {
2998
3006
/**
2999
3007
* The ArrayBuffer instance referenced by the array.
3000
3008
*/
3001
- readonly buffer: ArrayBuffer ;
3009
+ readonly buffer: ArrayBufferLike ;
3002
3010
3003
3011
/**
3004
3012
* The length in bytes of the array.
@@ -3242,7 +3250,7 @@ interface Int32ArrayConstructor {
3242
3250
readonly prototype: Int32Array;
3243
3251
new (length: number): Int32Array;
3244
3252
new (array: ArrayLike<number>): Int32Array;
3245
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Int32Array;
3253
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Int32Array;
3246
3254
3247
3255
/**
3248
3256
* The size in bytes of each element in the array.
@@ -3282,7 +3290,7 @@ interface Uint32Array {
3282
3290
/**
3283
3291
* The ArrayBuffer instance referenced by the array.
3284
3292
*/
3285
- readonly buffer: ArrayBuffer ;
3293
+ readonly buffer: ArrayBufferLike ;
3286
3294
3287
3295
/**
3288
3296
* The length in bytes of the array.
@@ -3526,7 +3534,7 @@ interface Uint32ArrayConstructor {
3526
3534
readonly prototype: Uint32Array;
3527
3535
new (length: number): Uint32Array;
3528
3536
new (array: ArrayLike<number>): Uint32Array;
3529
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Uint32Array;
3537
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Uint32Array;
3530
3538
3531
3539
/**
3532
3540
* The size in bytes of each element in the array.
@@ -3566,7 +3574,7 @@ interface Float32Array {
3566
3574
/**
3567
3575
* The ArrayBuffer instance referenced by the array.
3568
3576
*/
3569
- readonly buffer: ArrayBuffer ;
3577
+ readonly buffer: ArrayBufferLike ;
3570
3578
3571
3579
/**
3572
3580
* The length in bytes of the array.
@@ -3810,7 +3818,7 @@ interface Float32ArrayConstructor {
3810
3818
readonly prototype: Float32Array;
3811
3819
new (length: number): Float32Array;
3812
3820
new (array: ArrayLike<number>): Float32Array;
3813
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Float32Array;
3821
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Float32Array;
3814
3822
3815
3823
/**
3816
3824
* The size in bytes of each element in the array.
@@ -3851,7 +3859,7 @@ interface Float64Array {
3851
3859
/**
3852
3860
* The ArrayBuffer instance referenced by the array.
3853
3861
*/
3854
- readonly buffer: ArrayBuffer ;
3862
+ readonly buffer: ArrayBufferLike ;
3855
3863
3856
3864
/**
3857
3865
* The length in bytes of the array.
@@ -4095,7 +4103,7 @@ interface Float64ArrayConstructor {
4095
4103
readonly prototype: Float64Array;
4096
4104
new (length: number): Float64Array;
4097
4105
new (array: ArrayLike<number>): Float64Array;
4098
- new (buffer: ArrayBuffer , byteOffset?: number, length?: number): Float64Array;
4106
+ new (buffer: ArrayBufferLike , byteOffset?: number, length?: number): Float64Array;
4099
4107
4100
4108
/**
4101
4109
* The size in bytes of each element in the array.
0 commit comments