From 38ef4cf261ba258c181e312ae5a44c0893a0aa9b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 10 Apr 2019 08:25:29 -0700 Subject: [PATCH] Cleanup for DOM update in typescript@next 1. awesomeplete: Switch off of now-removed type name. 2. emscripten: Remove dependency on webassembly-js-api now that 3.5 has it in the DOM. 3. webassembly-web-api: Same I'll remove webassembly-js-api in a separate PR since it's no longer needed. --- types/awesomplete/index.d.ts | 4 ++-- types/emscripten/emscripten-tests.ts | 2 +- types/emscripten/index.d.ts | 19 ++++++++++++++----- types/webassembly-web-api/index.d.ts | 9 ++++++--- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/types/awesomplete/index.d.ts b/types/awesomplete/index.d.ts index 9f5060de03..a710b4b584 100644 --- a/types/awesomplete/index.d.ts +++ b/types/awesomplete/index.d.ts @@ -9,10 +9,10 @@ declare class Awesomplete { constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options); static all: any[]; - static $$(expr: string | NodeSelector, con?: any): NodeList; + static $$(expr: string | ParentNode, con?: any): NodeList; static ITEM: (text: string, input: string) => HTMLElement; static $: { - (expr: string|Element, con?: NodeSelector): string | Element; + (expr: string|Element, con?: ParentNode): string | Element; regExpEscape(s: { replace(arg0: RegExp, arg1: string): void }): any; create(tag: string, o: any): HTMLElement; fire(target: EventTarget, type: string, properties: any): any; diff --git a/types/emscripten/emscripten-tests.ts b/types/emscripten/emscripten-tests.ts index 627efba590..2057f012a5 100644 --- a/types/emscripten/emscripten-tests.ts +++ b/types/emscripten/emscripten-tests.ts @@ -8,7 +8,7 @@ function ModuleTest(): void { Module.preinitializedWebGLContext = new WebGLRenderingContext(); let package: ArrayBuffer = Module.getPreloadedPackage("package-name", 100); - let exports: WebAssembly.Exports = Module.instantiateWasm( + let exports: Module.WebAssemblyExports = Module.instantiateWasm( [{name: "func-name", kind: "function"}], (module: WebAssembly.Module) => {} ); diff --git a/types/emscripten/index.d.ts b/types/emscripten/index.d.ts index 4db8ac4925..5a9bbb1444 100644 --- a/types/emscripten/index.d.ts +++ b/types/emscripten/index.d.ts @@ -3,9 +3,7 @@ // Definitions by: Kensuke Matsuzaki // Periklis Tsirakidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// +// TypeScript Version: 3.5 declare namespace Emscripten { interface FileSystemType { @@ -15,6 +13,17 @@ declare namespace Emscripten { declare namespace Module { type EnvironmentType = "WEB" | "NODE" | "SHELL" | "WORKER"; + type WebAssemblyImports = Array<{ + name: string; + kind: string; + }>; + + type WebAssemblyExports = Array<{ + module: string; + name: string; + kind: string; + }>; + function print(str: string): void; function printErr(str: string): void; var arguments: string[]; @@ -32,9 +41,9 @@ declare namespace Module { function destroy(object: object): void; function getPreloadedPackage(remotePackageName: string, remotePackageSize: number): ArrayBuffer; function instantiateWasm( - imports: WebAssembly.Imports, + imports: WebAssemblyImports, successCallback: (module: WebAssembly.Module) => void - ): WebAssembly.Exports; + ): WebAssemblyExports; function locateFile(url: string): string; function onCustomMessage(event: MessageEvent): void; diff --git a/types/webassembly-web-api/index.d.ts b/types/webassembly-web-api/index.d.ts index 974dd3ce21..e5e35c5ad5 100644 --- a/types/webassembly-web-api/index.d.ts +++ b/types/webassembly-web-api/index.d.ts @@ -2,9 +2,7 @@ // Project: https://webassembly.org/ // Definitions by: Johannes Henninger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// +// TypeScript Version: 3.5 /** * The WebAssembly Web API defines extensions to the JavaScript API made @@ -12,6 +10,11 @@ * API](https://www.w3.org/TR/wasm-web-api-1/) for more information. */ declare namespace WebAssembly { + interface ResultObject { + module: Module; + instance: Instance; + } + function compileStreaming(source: Response | Promise): Promise; function instantiateStreaming(source: Response | Promise, importObject?: object): Promise; }