【发布时间】:2020-01-15 04:16:30
【问题描述】:
我在这上面花了一个小时,我不知道还有什么可以尝试或阅读以找出问题所在。
我已将谷歌 api 库包含到项目中
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_KEY&libraries=places"></script>
和安装的类型
npm install --save @types/googlemaps
现在在我的服务中,我想使用来自 googlemap 库的类:
type AutocompletePrediction = google.maps.places.AutocompleteService.AutocompletePrediction;
typescript 用红色在AutocompleteService 下划线并表示:
Namespace 'google.maps.places' has no exported member 'AutocompleteService'.
但实际上当我检查谷歌打字定义时,我可以清楚地看到它。
问题可能出在哪里? 任何提示表示赞赏,谢谢:)
我在 Mac OS 10.14.6 Mojave 上,使用 VScode 版本:1.41.1
PS:我不能忽略它,因为我的管道因同样的错误而中断:/
【问题讨论】:
标签: typescript visual-studio-code