TypeScript exports issue while returning workerpools
- Langage dominant
- TypeScript
- Étoiles
- 3.5k
- Forks
- 173
- Métriques de merge des PR
- Aucune PR mergée en 30 j
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.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.