1
我目前在网上看到的答案看似过时。使用类型定义在TypeScript中导入节点模块
我安装了node_modules/leaflet-draw
和node_modules/@types/leaflet-draw
。
这条线的工作原理:
import * as L from 'leaflet';
然而,这行不:
import * as foo from 'leaflet-draw';
我收到此错误:
/node_modules/@types/leaflet-draw/index.d.ts' is not a module.
要添加的混乱,这条线的工作原理:
var leafletDraw = require('leaflet-draw');
谁能帮我理解这一点?
这种情况下适当的进口声明是什么? –
我会用'import *'作为'from'传单';'从TypeScript的角度来看。假设传单和宣传单设置正确,“L”应具有宣传单的所有属性(以及传单的属性)。 – y2bd