简体   繁体   English

类型“typeof”上不存在属性“utm”

[英]Property 'utm' does not exist on type 'typeof

I'm doing the front-end of a project using Angular 10.我正在使用 Angular 10 做一个项目的前端。

In it I'm using leaflet to display maps but there was a need to install the dependency (leaflet.utm) , but I have no idea how to distinguish the L from the two libraries (leaflet and leatlet.utm).在其中,我使用 leaflet 来显示地图,但需要安装依赖项 (leaflet.utm) ,但我不知道如何将L与两个库(leaflet 和leatlet.utm)区分开来。

module installation:模块安装:

npm i leaflet.utm@0.0.4

import:进口:

...
import * as L from 'leaflet';
...

Code I'm attempting to use:我尝试使用的代码:

var item = L.utm({x: 467486.3, y: 4101149.3, zone: 30, band: 'S'});

Thrown Exception:抛出异常:

 Property 'utm' does not exist on type 'typeof import("../node_modules/@types/leaflet/index")'.ts(2339)

You need to import leaflet.utm too:您还需要导入leaflet.utm

import * as L from 'leaflet';
import 'leaflet.utm';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM