From 2ec8265fe352d8f511151d61cc78493da1e4ea2a Mon Sep 17 00:00:00 2001 From: Benedikt Meurer Date: Mon, 5 Oct 2020 15:21:18 +0200 Subject: [PATCH] [ts] Type-check wasmparser_worker/WasmParserWorker.js with TypeScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:1011811 Change-Id: Icd9d84fab2f62b63b831a3ffa9b81165b7d06643 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2449589 Commit-Queue: Benedikt Meurer Auto-Submit: Benedikt Meurer Reviewed-by: Simon Zünd --- .../wasmparser_worker/WasmParserWorker.js | 19 +++++++------------ .../wasmparser_worker/wasmparser_worker.js | 1 - 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/front_end/wasmparser_worker/WasmParserWorker.js b/front_end/wasmparser_worker/WasmParserWorker.js index 8d05cf1965..3f00dc1519 100644 --- a/front_end/wasmparser_worker/WasmParserWorker.js +++ b/front_end/wasmparser_worker/WasmParserWorker.js @@ -28,9 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as Common from '../common/common.js'; import * as WasmDis from '../third_party/wasmparser/package/dist/esm/WasmDis.js'; import * as WasmParser from '../third_party/wasmparser/package/dist/esm/WasmParser.js'; @@ -59,10 +56,14 @@ class BinaryReaderWithProgress extends WasmParser.BinaryReader { } } +/** + * + * @param {!{data: !{method:string, params: !{content: string}}}} event + */ self.onmessage = async function(event) { - const method = /** @type {string} */ (event.data.method); - const params = /** @type !{content: string} */ (event.data.params); - if (!method || method !== 'disassemble') { + const method = (event.data.method); + const params = (event.data.params); + if (method !== 'disassemble') { return; } @@ -113,9 +114,3 @@ self.onmessage = async function(event) { this.postMessage({method: 'disassemble', result: {source, offsets, functionBodyOffsets}}); }; - -/* Legacy exported object */ -self.WasmParserWorker = self.WasmParserWorker || {}; - -/* Legacy exported object */ -WasmParserWorker = WasmParserWorker || {}; diff --git a/front_end/wasmparser_worker/wasmparser_worker.js b/front_end/wasmparser_worker/wasmparser_worker.js index d2c5daef06..8c1a3af371 100644 --- a/front_end/wasmparser_worker/wasmparser_worker.js +++ b/front_end/wasmparser_worker/wasmparser_worker.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - import * as WasmParserWorker from './WasmParserWorker.js'; export {