You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code TypeScript IntelliSense不提示global.d.ts中的全局命名空间

全局命名空间的IntelliSense补全问题

在应用中声明全局命名空间后,代码可正常运行且无编译错误,但IntelliSense存在补全异常:输入命名空间名称(如libTypes)时无补全提示,不过输入libTypes.后,IntelliSense会正常列出该命名空间下的所有可用类型。

相关代码示例

global.d.ts 示例

import * as _libTypes from 'library/types';
declare global {
    const libTypes: typeof _libTypes;
}

export as namespace libTypes;
export = _libTypes;

tsconfig.json 配置

{
  "files": [
    "src/main.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

内容的提问来源于stack exchange,提问作者Valentin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 20:32:00