智能感知不适用于多个文件

Intellisense not working on multiple files

我目前正在开发一些 JS/ES 带有 vscode 和一堆扩展的项目。 但遗憾的是,VSCode 的智能感知功能没有按预期工作。

请参阅存储库 https://github.com/svennergr/intellisense-test 作为我项目的示例设置。 我所说的确切点是 Main.js 中 "component" 的智能感知或类型声明。 VSCode 显示类型 "Component" 与任何类型一样:

仅当我将组件及其 typedef 导入 Main.js 文件时,智能感知定义才按预期工作:

但是我不想在这里导入这个,因为我不再使用它了。 有没有办法配置 VSCode 的智能感知也从其他项目文件中获取类型定义?

提前致谢。

我想通了,肯定需要任何类型的导入。不能将 Component 导入到整个文件中,只能像下面这样导入到 typedef 中:

   * @param {import('./Component').default} [component] The component to assign.