node.js - Windows 和 macos 上的 VS Code Intellisense 中 NodeJS“全局”对象的类型声明不同
问题描述
我在 OSX 和 Windows 上安装了 VS Code。我在两个系统上都做了非常简单的测试:
创建一个包含以下内容的文件 app.js:
const fs = require('fs');
console.log(global);
然后我 ctrl+单击global
符号,我在两个系统上得到的声明是不同的。在 Windows 上,我得到这个:
declare var global: typeof globalThis;
如文件中所定义:C:\Users\user\AppData\Local\Microsoft\Typescript\4.3\node_modules\@types\node\globals.global.d.ts
在 MacOS 上我得到这个:
declare var global: NodeJS.Global & typeof globalThis;
如文件中所定义:Users/user/Library/Caches/typescript/4.4/node_modules/@types/node/globals.global.d.ts
请注意,我之前有过这个4.2
版本,但声明在 MacOS 上4.2
和. 之间是相同的4.4
。
谁能告诉我发生了什么以及为什么操作系统之间的声明不同?
解决方案
推荐阅读
- tensorflow - Tensorflow Object Detection API 的数据增强是否会产生比原始样本更多的样本?
- jquery - 我如何用伪代码编写这些 jquery 方法?
- angular - Angular:等待加载异步数据的正确方法
- android - java:将位置转换为字符串并返回
- oracle-apex - 将应用程序从 APEX 18.2 导入到 APEX 5.1.3
- python - Python 机器人,添加反应
- odoo - 如何更改 odoo 中的默认数据库架构?
- python - 获取二维数组的 ArgMax
- python - 用递归解释子集创建
- javascript - 如何在 React Native 中制作抖动图像动画?