导入 DefinitelyTyped 模块 angular
importing DefinitelyTyped module angular
我和这个有同样的问题post =>
我正在尝试安装 VanillaTilt in to my Angular (TS) project. Using this index.d.ts...我将 d.ts
保存在与 app.component.ts
相同的目录中,如下所示
import VanillaTilt from 'vanilla-tilt';
VanillaTilt.init(document.createElement('a'), { perspective: 1000 });
但我收到以下 ts 错误
ERROR in src/app/app.component.ts(3,8): error TS1192: Module '"vanilla-tilt"' has no default export.
我也尝试了 d.ts
的 this version,但我一直得到 Cannot read property 'init' of undefined
有人对如何在 agular5 中使用 VanillaTilt 有什么建议吗?
现在可以在 npm 上进行打字了。首先安装它们
npm install --save-dev @types/vanilla-tilt
然后删除您的本地 .d.ts 文件
接下来,正确的导入语法是
import { VanillaTilt } from 'vanilla-tilt';
因为 VanillaTilt 有一个命名导出,而不是默认导出。
我和这个有同样的问题post =>
我正在尝试安装 VanillaTilt in to my Angular (TS) project. Using this index.d.ts...我将 d.ts
保存在与 app.component.ts
相同的目录中,如下所示
import VanillaTilt from 'vanilla-tilt';
VanillaTilt.init(document.createElement('a'), { perspective: 1000 });
但我收到以下 ts 错误
ERROR in src/app/app.component.ts(3,8): error TS1192: Module '"vanilla-tilt"' has no default export.
我也尝试了 d.ts
的 this version,但我一直得到 Cannot read property 'init' of undefined
有人对如何在 agular5 中使用 VanillaTilt 有什么建议吗?
现在可以在 npm 上进行打字了。首先安装它们
npm install --save-dev @types/vanilla-tilt
然后删除您的本地 .d.ts 文件
接下来,正确的导入语法是
import { VanillaTilt } from 'vanilla-tilt';
因为 VanillaTilt 有一个命名导出,而不是默认导出。