从Github存储库导入Angular组件-找不到模块或其对应的类型声明

问题描述

我想将Angular组件从GitHub上的一个Project / Module导入到另一个Project / Module。这是测试模块的链接https://github.com/tilo-ai/test-mod,带有测试组件。我在本地创建了另一个Angular Project并运行

npm install --save https://github.com/tilo-ai/test-mod

test-mod已添加到package.json:

"dependencies": {
  "test-mod": "git+https://github.com/tilo-ai/test-mod.git",},

我尝试使用

将TestCompComponent导入到我的app.module.ts中
import { TestCompComponent } from 'test-mod';

但我遇到此错误

Cannot find module 'test-mod' or its corresponding type declarations.

有人知道缺少什么吗?

解决方法

如果错误出现在编辑器中,请尝试此解决方案。 https://github.com/microsoft/vscode/issues/1915