gae*_*123 2 google-api node.js typescript google-cloud-platform
我刚刚添加"@google-cloud/logging-winston":"2.1.0",
到我的 pacakge.json 中,当我编译时出现以下错误。我偶尔会在其他 google 库中看到这种情况,其根本原因很可能在 protobuf 定义自动生成的类型的堆栈中更深。
../node_modules/@google-cloud/logging/build/proto/logging.d.ts:1434:32 - error TS2304: Cannot find name 'Long'.
1434 line?: (number|Long|null);
~~~~
../node_modules/@google-cloud/logging/build/proto/logging.d.ts:1453:38 - error TS2304: Cannot find name 'Long'.
1453 public line: (number|Long);
~~~~
../node_modules/@google-cloud/logging/build/proto/logging.d.ts:1543:39 - error TS2304: Cannot find name 'Long'.
1543 requestSize?: (number|Long|null);
~~~~
../node_modules/@google-cloud/logging/build/proto/logging.d.ts:1549:40 - error TS2304: Cannot find name 'Long'.
1549 responseSize?: (number|Long|null);
~~~~
../node_modules/@google-cloud/logging/build/proto/logging.d.ts:1576:42 - error TS2304: Cannot find name 'Long'.
1576 cacheFillBytes?: (number|Long|null);
Run Code Online (Sandbox Code Playgroud)
以下是我如何解决这个问题,直到它得到解决。
"long":"4.0.0",
"@types/long":"4.0.0",
{
"compilerOptions": {
...
"types": [
...
"long"
],
...
}
Run Code Online (Sandbox Code Playgroud)
小智 5
gae123 的建议在 typescript 版本 4.9.4 上对我不起作用。我将以下内容添加到 tsconfig.json。希望这可以帮助。
"compilerOptions":{
...
"skipLibCheck": true,
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1214 次 |
最近记录: |