File tree 2 files changed +6
-14
lines changed
2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -501,12 +501,16 @@ export class SwiftRuntime {
501
501
return func_ref ;
502
502
} ,
503
503
504
- swjs_create_typed_array : (
504
+ swjs_create_typed_array : < T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array | Float32Array | Float64Array | Uint8ClampedArray > (
505
505
constructor_ref : ref ,
506
506
elementsPtr : pointer ,
507
507
length : number
508
508
) => {
509
- const ArrayType : TypedArray =
509
+ type TypedArrayConstructor = {
510
+ new ( buffer : ArrayBuffer , byteOffset : number , length : number ) : T ;
511
+ new ( ) : T ;
512
+ } ;
513
+ const ArrayType : TypedArrayConstructor =
510
514
this . memory . getObject ( constructor_ref ) ;
511
515
if ( length == 0 ) {
512
516
// The elementsPtr can be unaligned in Swift's Array
Original file line number Diff line number Diff line change @@ -28,18 +28,6 @@ export const enum LibraryFeatures {
28
28
WeakRefs = 1 << 0 ,
29
29
}
30
30
31
- export type TypedArray =
32
- | Int8ArrayConstructor
33
- | Uint8ArrayConstructor
34
- | Int16ArrayConstructor
35
- | Uint16ArrayConstructor
36
- | Int32ArrayConstructor
37
- | Uint32ArrayConstructor
38
- | BigInt64ArrayConstructor
39
- | BigUint64ArrayConstructor
40
- | Float32ArrayConstructor
41
- | Float64ArrayConstructor ;
42
-
43
31
export function assertNever ( x : never , message : string ) {
44
32
throw new Error ( message ) ;
45
33
}
You can’t perform that action at this time.
0 commit comments