【发布时间】:2021-05-05 11:34:22
【问题描述】:
我有一个自定义 ammo.js 构建在我想要加载的 reactjs 应用程序中,在 typescript 中。 不幸的是,它不起作用。
我不得不抑制 eslint,更漂亮的是不使用 ammojs api 应用它。
reactjs v16
import * as Ammo from './ammo.js';
Ammo().then (console.log('ammojs loaded'));
我有这个错误:
编译失败
/home/sancelot/git/courbes-simulation/src/components/Child.tsx
/home/sancelot/git/courbes-simulation/src/components/Child.tsx(10,1) 中的 TypeScript 错误:
此表达式不可调用。
类型“typeof Ammo”没有呼叫签名。 TS2349
8 | // @ts-忽略
9 |从 './ammo.js' 导入 * 作为弹药;
10 | Ammo().then (console.log('ammojs loaded'));
| ^
11 |
12 |
13 |类型道具 = {
此错误发生在构建期间,无法消除。
【问题讨论】:
标签: javascript reactjs typescript ammo.js