xieziyu / ngx-amap

angular 2+ component for AMap (Gaode map)
https://xieziyu.github.io/ngx-amap
MIT License
148 stars 42 forks source link

error TS2694: Namespace 'AMap' has no exported member 'Driving' #72

Open Simonsmile opened 4 years ago

Simonsmile commented 4 years ago

我可以顺利使用ngx-amap,但是在调用服务的驾车路径规划时碰到提示: error TS2694: Namespace 'AMap' has no exported member 'Driving'

我的安装包如下: "dependencies": { ...... "ngx-amap": "^3.0.5", ...... }, "devDependencies": { ...... "@types/amap-js-api": "^1.4.7", "@types/amap-js-api-autocomplete": "^1.4.0", "@types/amap-js-api-driving": "^1.4.0", "@types/amap-js-api-heatmap": "^1.4.0", "@types/amap-js-api-place-search": "^1.4.0", "@types/amap-js-api-tool-bar": "^1.4.0", "@types/amap-js-api-transfer": "^1.4.0", ...... }

但是我下载了您的Github Demo,路径规划是正常的,请问我应该修改什么设置?

ManonLoki commented 4 years ago

同楼上问题 我用到的是DistrictSearch这个插件 angular版本 8.3.25
typescript版本 3.5.3

错误提示 error TS2339: Property 'DistrictSearch' does not exist on type 'typeof AMap'. 开发依赖的包版本 "@types/amap-js-api-district-search": "^1.4.0", 请问我是否应该修改tsconfig某些设置

ManonLoki commented 4 years ago

解决了…… 在 tsconfig.app.json {

"compilerOptions": { "outDir": "./out-tsc/app", "types": [ "@types/amap-js-api-district-search" // 依赖的插件定义文件路径 ] }, ... }

Simonsmile commented 4 years ago

@

解决了…… 在 tsconfig.app.json {

"compilerOptions": { "outDir": "./out-tsc/app", "types": [ "@types/amap-js-api-district-search" // 依赖的插件定义文件路径 ] }, ... }

ManonLoki, Thanks alot!

这个参数设置太难找了,顺便对比一下Demo的文件内容: tsconfig.app.json: { ...... "compilerOptions": { "outDir": "./out-tsc/app", "types": [ "@types/amap-js-api-driving", "@types/amap-js-api-place-search", "@types/amap-js-api-transfer", "@types/amap-js-api-autocomplete" ] }, ...... }

tsconfig.json { "compileOnSave": false, "compilerOptions": { ...... "lib": [ "es2018", "dom" ], "paths": { "ngx-amap": [ "dist/ngx-amap" ], "ngx-amap/": [ "dist/ngx-amap/" ] } }, ...... }