threads.js
threads.js copied to clipboard
Expose types so typescript users can use them
https://github.com/andywer/threads.js/blob/762337476637f83f38876b9f25ec5e5816c47594/src/master/spawn.ts#L23-L25
I need to write this:
private wikiWorkers: Record<string, ArbitraryThreadType> = {};
but Module '"threads"' has no exported member 'ArbitraryThreadType'.ts(2305)
Using PromiseValue<ReturnType<typeof spawn>>
now.
Needs import { PromiseValue } from 'type-fest';
import { WorkerEvent, WorkerEventType } from 'threads/dist/types/master';
will cause
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/types/master' is not defined by "exports" in /Users/linonetwo/Desktop/repo/TiddlyGit-Desktop/node_modules/threads/package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
use import type { WorkerEvent } from 'threads/dist/types/master';
solves this.
Hey @linonetwo! Sorry for the late reply.
Can you please list all the types that you would need to have exposed? Makes it much easier to discuss (if at all necessary) and implement. Feel free to open a PR, too.