Skip to content

Commit

Permalink
feat: use the correct types for WorkerConstructor and workerPath
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 9, 2020
1 parent 0cdc16b commit d0d1615
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/createWorker.ts
Original file line number Diff line number Diff line change
@@ -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 :
Expand Down

0 comments on commit d0d1615

Please sign in to comment.