andywer / andywer/threads.js

TypeScript exports issue while returning workerpools

オープン
#417 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
3.5k
フォーク
173
PR マージ指標
30日以内にマージされた PR はありません

説明

```
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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。