andywer / andywer/threads.js

TypeScript exports issue while returning workerpools

Open
#417 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.5k
Forks
173
PR merge metrics
No merged PRs in 30d

Description

```
Exported variable 'getWorkers' has or is using name 'WorkerPool' from external module "/home/admin/Coding/project/node_modules/threads/dist/master/pool" but cannot be named.
```

```typescript
import { cpus } from 'node:os'
import { Pool, Worker, spawn } from 'threads'
import { TWorker as TWorkerGeneral } from '../workers/general'

const getWorkers = async () => {
const cpuCores = cpus.length
const optionsPool = {
concurrency: cpuCores,
size: cpuCores,
}

const [general] = await Promise.all([
Pool(
() => spawn(new Worker('../workers/general')),
optionsPool,
),
])

return {
general,
}
}

export type TWorkers = Awaited
```

Need to export https://github.com/andywer/threads.js/blob/master/src/master/pool.ts#L114 but that needs to be your decision.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.