0
我通過npm安裝了https://github.com/PaulLeCam/react-leaflet以及@types/react-leaflet
。它工作正常,如果我導入@types/react-leaflet
定義的東西,像這樣在我自己的代碼庫中爲TypeScript模塊定義缺失的類
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。