@@ -7,24 +7,11 @@ interface ImportsObject extends Record<string, any> {
77 env ?: {
88 memory ?: WebAssembly . Memory ,
99 table ?: WebAssembly . Table ,
10- abort ?: ( msg : number , file : number , line : number , column : number ) => void ,
11- trace ?: ( msg : number , numArgs ?: number , ...args : any [ ] ) => void
12- }
10+ abort ?( msg : number , file : number , line : number , column : number ) : void ,
11+ trace ?( msg : number , numArgs ?: number , ...args : number [ ] ) : void
12+ } ;
1313}
1414
15- type TypedArray
16- = Int8Array
17- | Uint8Array
18- | Uint8ClampedArray
19- | Int16Array
20- | Uint16Array
21- | Int32Array
22- | Uint32Array
23- | Float32Array
24- | Float64Array
25- | BigInt64Array
26- | BigUint64Array ;
27-
2815/** Utility mixed in by the loader. */
2916interface ASUtil {
3017 /** Explicit start function, if requested. */
@@ -34,32 +21,32 @@ interface ASUtil {
3421 /** Reads (copies) the value of a string from the module's memory. */
3522 __getString ( ptr : number ) : string ;
3623 /** Allocates a new array in the module's memory and returns a reference (pointer) to it. */
37- __allocArray ( id : number , values : number [ ] ) : number ;
24+ __allocArray ( id : number , values : ArrayLike < number > ) : number ;
3825 /** Reads (copies) the values of an array from the module's memory. */
3926 __getArray ( ptr : number ) : number [ ] ;
4027 /** Gets a view on the values of an array in the module's memory. */
41- __getArrayView ( ptr : number ) : TypedArray ;
42- /** Reads (copies) the values of Int8Array from the module's memory. */
28+ __getArrayView ( ptr : number ) : ArrayBufferView ;
29+ /** Reads the values of Int8Array from the module's memory. */
4330 __getInt8Array ( ptr : number ) : Int8Array ;
44- /** Reads (copies) the values of Uint8Array from the module's memory. */
31+ /** Reads the values of Uint8Array from the module's memory. */
4532 __getUint8Array ( ptr : number ) : Uint8Array ;
46- /** Reads (copies) the values of Uint8Array from the module's memory. */
33+ /** Reads the values of Uint8Array from the module's memory. */
4734 __getUint8ClampedArray ( ptr : number ) : Uint8ClampedArray ;
48- /** Reads (copies) the values of Int16Array from the module's memory. */
35+ /** Reads the values of Int16Array from the module's memory. */
4936 __getInt16Array ( ptr : number ) : Int16Array ;
50- /** Reads (copies) the values of Uint16Array from the module's memory. */
37+ /** Reads the values of Uint16Array from the module's memory. */
5138 __getUint16Array ( ptr : number ) : Uint16Array ;
52- /** Reads (copies) the values of Int32Array from the module's memory. */
39+ /** Reads the values of Int32Array from the module's memory. */
5340 __getInt32Array ( ptr : number ) : Int32Array ;
54- /** Reads (copies) the values of Uint32Array from the module's memory. */
41+ /** Reads the values of Uint32Array from the module's memory. */
5542 __getUint32Array ( ptr : number ) : Uint32Array ;
56- /** Reads (copies) the values of Int32Array from the module's memory. */
57- __getInt64Array ( ptr : number ) : BigInt32Array ;
58- /** Reads (copies) the values of Uint32Array from the module's memory. */
59- __getUint64Array ( ptr : number ) : BigUint32Array ;
60- /** Reads (copies) the values of Float32Array from the module's memory. */
43+ /** Reads the values of Int32Array from the module's memory. */
44+ __getInt64Array ( ptr : number ) : BigInt64Array ;
45+ /** Reads the values of Uint32Array from the module's memory. */
46+ __getUint64Array ( ptr : number ) : BigUint64Array ;
47+ /** Reads the values of Float32Array from the module's memory. */
6148 __getFloat32Array ( ptr : number ) : Float32Array ;
62- /** Reads (copies) the values of Float64Array from the module's memory. */
49+ /** Reads the values of Float64Array from the module's memory. */
6350 __getFloat64Array ( ptr : number ) : Float64Array ;
6451 /** Reads (copies) the data of an ArrayBuffer from the module's memory. */
6552 __getArrayBuffer ( ptr : number ) : ArrayBuffer ;
@@ -79,10 +66,10 @@ interface ASUtil {
7966export declare function instantiate < T extends { } > ( module : WebAssembly . Module , imports ?: ImportsObject ) : ASUtil & T ;
8067
8168/** Instantiates an AssemblyScript module from a buffer using the specified imports. */
82- export declare function instantiateBuffer < T extends { } > ( buffer : Uint8Array , imports ?: ImportsObject ) : ASUtil & T ;
69+ export declare function instantiateBuffer < T extends { } > ( buffer : BufferSource , imports ?: ImportsObject ) : ASUtil & T ;
8370
8471/** Instantiates an AssemblyScript module from a response using the specified imports. */
85- export declare function instantiateStreaming < T extends { } > ( result : Promise < Response > , imports ?: ImportsObject ) : Promise < ASUtil & T > ;
72+ export declare function instantiateStreaming < T extends { } > ( result : Response | PromiseLike < Response > , imports ?: ImportsObject ) : Promise < ASUtil & T > ;
8673
8774/** Demangles an AssemblyScript module's exports to a friendly object structure. */
8875export declare function demangle < T extends { } > ( exports : { } , baseModule ?: { } ) : T ;
0 commit comments