2016-10-02 74 views
12

我使用打字稿2.0与最新的[email protected]构建过程。如何从`@ types`打字稿中导入类型定义2.0

我安装谷歌与地图类型是这样的:

npm install @types/google-maps --save-dev --save-exact

,我试图导入一些类型定义成我这样的代码

/// <reference types="google-maps" /> 
import { LatLng, LatLngBounds } from 'google-maps'; 

,但我得到此打字稿错误:

./node_modules/@types/google-maps/index.d.ts has no exported member 'LatLng'

,如果我看在源,其实我觉得在

./node_modules/@types/google-maps/node_modules/@types/googlemaps/index.d.ts

回答

0

import只适用于当前的包,而不是它的依赖关系的定义。

所以,你需要import { LatLng, LatLngBounds } from 'googlemaps'

+0

这并不提供答案的问题。要批评或要求作者澄清,请在其帖子下方留言。 - [来自评论](/ review/low-quality-posts/18095085) –