From fa61956f03491101b6ef64423ea2f1f73af26a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 19 Jul 2020 19:49:44 +0200 Subject: Port internal TS code to JS (#6793) Co-authored-by: Ryan Dahl --- cli/js2/lib.deno.worker.d.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 cli/js2/lib.deno.worker.d.ts (limited to 'cli/js2/lib.deno.worker.d.ts') diff --git a/cli/js2/lib.deno.worker.d.ts b/cli/js2/lib.deno.worker.d.ts new file mode 100644 index 000000000..95aa16139 --- /dev/null +++ b/cli/js2/lib.deno.worker.d.ts @@ -0,0 +1,43 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */ + +/// +/// +/// +/// + +declare interface DedicatedWorkerGlobalScope { + self: DedicatedWorkerGlobalScope & typeof globalThis; + onmessage: (e: MessageEvent) => void; + onmessageerror: (e: MessageEvent) => void; + onerror: undefined | typeof onerror; + name: typeof __workerMain.name; + close: typeof __workerMain.close; + postMessage: typeof __workerMain.postMessage; + Deno: typeof Deno; +} + +declare const self: DedicatedWorkerGlobalScope & typeof globalThis; +declare let onmessage: ((e: { data: any }) => Promise | void) | undefined; +declare let onerror: + | (( + msg: string, + source: string, + lineno: number, + colno: number, + e: Event, + ) => boolean | void) + | undefined; +declare const close: typeof __workerMain.close; +declare const name: typeof __workerMain.name; +declare const postMessage: typeof __workerMain.postMessage; + +declare namespace __workerMain { + export let onmessage: (e: { data: any }) => void; + export function postMessage(data: any): void; + export function close(): void; + export const name: string; +} + +/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */ -- cgit v1.2.3