diff --git a/lib/loader/index.d.ts b/lib/loader/index.d.ts index 5e2f883c2e..b57bd39189 100644 --- a/lib/loader/index.d.ts +++ b/lib/loader/index.d.ts @@ -1,22 +1,25 @@ /// -interface ResultObject { - module: WebAssembly.Module, - instance: WebAssembly.Instance -}; +export interface ResultObject { + module: WebAssembly.Module; + instance: WebAssembly.Instance; +} + +type ImportValue = Function | WebAssembly.Global | WebAssembly.Memory | WebAssembly.Table | number; /** WebAssembly imports with two levels of nesting. */ -interface ImportsObject extends Record { +export interface Imports extends Record> { env?: { memory?: WebAssembly.Memory, table?: WebAssembly.Table, + seed?: () => number, abort?(msg: number, file: number, line: number, column: number): void, trace?(msg: number, numArgs?: number, ...args: number[]): void }; } /** Utility mixed in by the loader. */ -interface ASUtil { +export interface ASUtil { memory?: WebAssembly.Memory; table?: WebAssembly.Table; @@ -99,19 +102,19 @@ interface ASUtil { /** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */ export declare function instantiate( source: WebAssembly.Module | BufferSource | Response | PromiseLike, - imports?: ImportsObject + imports?: Imports ): Promise; /** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */ export declare function instantiateSync( source: WebAssembly.Module | BufferSource, - imports?: ImportsObject + imports?: Imports ): ResultObject & { exports: ASUtil & T }; /** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */ export declare function instantiateStreaming( source: Response | PromiseLike, - imports?: ImportsObject + imports?: Imports ): Promise; /** Demangles an AssemblyScript module's exports to a friendly object structure. */