找不到带有打字稿和deno的名称
这是我的代码:
/**
* map.ts
*/
// @deno-types="./libs/@types/geojson/index.d.ts"
// @deno-types="./libs/@types/mapbox-gl/index.d.ts"
mapboxgl.accessToken = "toto";
var map = new mapboxgl.Map({
container: 'map', // container id
style: 'mapbox://styles/mapbox/streets-v11', // style URL
center: [-74.5, 40], // starting position [lng, lat]
zoom: 9 // starting zoom
});
但即使我已经导入了 mapbox 的定义
// @deno-types="./libs/@types/geojson/index.d.ts"
// @deno-types="./libs/@types/mapbox-gl/index.d.ts"
我有错误:
error: TS2304 [ERROR]: Cannot find name 'mapboxgl'.
mapboxgl.accessToken = "toto";
~~~~~~~~
at file:///home/bussiere/Workspace/testdeno2/map.ts:9:1
TS2304 [ERROR]: Cannot find name 'mapboxgl'.
var map = new mapboxgl.Map({
~~~~~~~~
at file:///home/bussiere/Workspace/testdeno2/map.ts:11:15
Found 2 errors.
如何以能够使用名称和定义的方式正确导入定义。
这是 github:https :
//github.com/bussiere/testdeno2
编辑 :
这是未捕获的错误:
error: Uncaught (in promise) RuntimeError: unreachable
at <anonymous> (wasm://wasm/00247702:1:336403)
at <anonymous> (wasm://wasm/00247702:1:341096)
at <anonymous> (wasm://wasm/00247702:1:339419)
at <anonymous> (wasm://wasm/00247702:1:339781)
at <anonymous> (wasm://wasm/00247702:1:336272)
at <anonymous> (wasm://wasm/00247702:1:268321)
at minify (wasm://wasm/00247702:1:253183)
at minify (https://deno.land/x/minifier@v1.1.1/wasm.js:98:14)
at minify (https://deno.land/x/minifier@v1.1.1/mod.ts:27:10)
at https://deno.land/x/minifier@v1.1.1/cli.ts:53:3
问候