From d0d16156c10d8c3d59e27b3034ce1eab057ff3e5 Mon Sep 17 00:00:00 2001 From: aminya Date: Sun, 9 Aug 2020 02:14:49 -0500 Subject: [PATCH] feat: use the correct types for WorkerConstructor and workerPath --- src/createWorker.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/createWorker.ts b/src/createWorker.ts index 608f4421..f58117a5 100644 --- a/src/createWorker.ts +++ b/src/createWorker.ts @@ -1,13 +1,18 @@ import {getWorkerImplementation as getWebWorker} from "./master/implementation.browser" -import {getWorkerImplementation as getNodeWorker} from "./master/implementation.node" +import {getWorkerImplementation as getNodeWorker } from "./master/implementation.node" + +import { + BlobWorker, + WorkerImplementation, +} from "./types/master" interface WorkerOptions { backend: string blob: boolean } -export function createWorker(workerPath: string, options: WorkerOptions) { - let WorkerConstructor: any +export function createWorker(workerPath: string & Blob, options: WorkerOptions) { + let WorkerConstructor: typeof WorkerImplementation | typeof BlobWorker if (options.backend === "web") { WorkerConstructor = options.blob ? getWebWorker().blob :