在当前范围内不存在名称“缓冲区”。

时间:2022-01-21 19:18:20

a.ts

///<reference path="node/node.d.ts" />
class A {
  constructor(public b: Buffer) {
  }
}

tsc a.ts

tsc“

(3,24): The name 'Buffer' does not exist in the current scope

(3,24):“Buffer”在当前作用域中不存在

1 个解决方案

#1


3  

It looks like you have to have the type be "NodeBuffer" rather than "Buffer".

看起来您必须将类型设置为“NodeBuffer”而不是“Buffer”。

///<reference path="node/node.d.ts" />
class A {
    constructor(public b: NodeBuffer) {
    }
}

#1


3  

It looks like you have to have the type be "NodeBuffer" rather than "Buffer".

看起来您必须将类型设置为“NodeBuffer”而不是“Buffer”。

///<reference path="node/node.d.ts" />
class A {
    constructor(public b: NodeBuffer) {
    }
}