From: Wink Saville Date: Sat, 1 Apr 2017 17:16:44 +0000 (-0700) Subject: As an experiment change WebAssembly.Module to a class X-Git-Tag: otter-0.2.0~707^2~3^2~4 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=cd591d20513f1b4b9015c4281fb4f11cf7c9f3e1;p=otter.git As an experiment change WebAssembly.Module to a class Close but it's not compiling I get the following error: ``` $ yarn test yarn test v0.21.3 $ tsc -p test/tsconfig.json test/wasm.ts(136,3): error TS2322: Type 'ResultObject' is not assignable to type 'Instance'. Property 'exports' is missing in type 'ResultObject'. error Command failed with exit code 2. ``` --- diff --git a/webassembly.d.ts b/webassembly.d.ts index 800da92b..165cee99 100644 --- a/webassembly.d.ts +++ b/webassembly.d.ts @@ -6,25 +6,20 @@ declare namespace WebAssembly { /** * WebAssembly.Module **/ - interface Module { - readonly [Symbol.toStringTag]: "Module"; - } + class Module { + constructor (bufferSource: ArrayBuffer | Uint8Array); - interface ModuleConstructor { - readonly prototype: Module; - new(bufferSource: ArrayBuffer | Uint8Array): Module; - customSections(module: Module, sectionName: string): ArrayBuffer[]; - exports(module: Module): { + static customSections(module: Module, sectionName: string): ArrayBuffer[]; + static exports(module: Module): { name: string; kind: string; }[]; - imports(module: Module): { + static imports(module: Module): { module: string; name: string; kind: string; }[]; } - const Module: ModuleConstructor; /** * WebAssembly.Instance