我导入了集群,
import * as cluster from "cluster";
当我尝试签cluster.isMaster入时if(cluster.isMaster){},出现此错误
TS2339: Property 'isMaster' does not exist on type 'typeof import("cluster")'.
Run Code Online (Sandbox Code Playgroud)
我
import cluster from "cluster";
得到的集群是undefined. 如何解决ts中的问题,如何在ts中导入集群并使用它们?
And*_*ets 10
我今天遇到了同样的问题,这个解决方法对我有用:
import * as _cluster from 'cluster';
const cluster = _cluster as unknown as _cluster.Cluster; // typings fix
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5664 次 |
| 最近记录: |