我通过npm和@types/react-leaflet
安装了https://github.com/PaulLeCam/react-leaflet。如果我导入@types/react-leaflet
中定义的内容,就像这样
import { Map, Marker, Popup, TileLayer } from "react-leaflet";
但是,如果我尝试导入@types/react-leaflet
作者在声明文件中遗漏的内容,例如MapLayer
。
import { MapLayer } from "react-leaflet";
然后抱怨这样的事情
[ts] Module '"/Users/foobar/workspace/webapp/node_modules/@types/react-leaflet/index"' has no exported member 'MapLayer'.
如果查看leaflet source code,您会注意到MapLayer
确实已导出。但由于缺少声明,我仍然无法导入它。所以我的问题是,如何在我自己的代码库中为缺失的MapLayer
做声明?我不想仅为缺少的课程发布新的npm。