javascript - 在 Angular 8 中导入 interactjs 1.7.2 不起作用

标签 javascript node.js angular typescript single-page-application

我正在尝试在 Angular 8 中导入 Interactive.js 1.7.2。我安装如下:

npm install interactjs@next

然后以不同的方式导入,但都不起作用:

import * as interact from 'interactjs';

import interact from 'interactjs'

import from 'interactjs';

import * as interact from '@interactjs/interactjs';

declare var interact:any; (with no imports)

解决方案here似乎对其他人有效,但对我无效。

启动 Angular 时出现很多错误,因此这一定是导入问题,例如我得到:

src/app/web/visuals/svg.rectangle.ts(65,25): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("C:/projects/myproject/node_modules/@interactjs/interactjs/index")' has no compatible call signatures.

../../node_modules/@interactjs/core/Interactable.d.ts(7,19): error TS1086: An accessor cannot be declared in an ambient context.

../../node_modules/@interactjs/core/Interaction.d.ts(74,45): error TS2304: Cannot find name 'Omit'.

如何解决这个问题?

更新

此问题已记录 here但没有解决办法。

最佳答案

你可以使用 es5 语法这样做

const interact = require('interactjs')

关于javascript - 在 Angular 8 中导入 interactjs 1.7.2 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59345676/

相关文章:

node.js - MongoDB Node 检查objectid是否有效

javascript - Angular 8 应用程序未在 Internet Explorer 中打开

javascript - Angular:委托(delegate)模式。在 ngFor 内部优化处理程序的方法

javascript - 如何让 block 元素高度自动而本身没有子元素

Javascript - 视频的播放/暂停按钮

node.js - 使用适用于 Linux 的 Windows 子系统在 Visual Studio Code 中进行调试

javascript - 使用 Joi、nodejs 验证 header 参数?

javascript - Angular 框架如何通过 Angular CLI 加载到应用程序中?

javascript - Google Chrome 中的西里尔字母 URL?

相当于 jquery ajaxStop 的 Javascript