Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Simonsmile opened this issue May 12, 2020 · 3 comments
Open

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

Simonsmile opened this issue May 12, 2020 · 3 comments

Comments

@Simonsmile
Copy link

我可以顺利使用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
Copy link

ManonLoki commented May 15, 2020

同楼上问题 我用到的是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
Copy link

ManonLoki commented May 15, 2020

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

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

@Simonsmile
Copy link
Author

@

解决了……
在 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/
"
]
}
},
......
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants