2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

@googlemaps/react-wrapperでgoogleの型定義を追加する方法

Posted at

@googlemaps/react-wrapperは、React用のGoogle Mapsのライブラリです。

TypeScriptで使用する時に型定義エラーが出た時の対処法になります。

出現するTypeScriptの型定義エラー

 const [map, setMap] = useState<google.maps.Map>()
名前空間 'google' が見つかりません。

googlemaps-react-wrapper.png

対処法

@types/google.mapsの型定義をインストールすることでエラーは解消されます。

npm i @types/google.maps
#OR
yarn add @types/google.maps

googlemaps-react-wrapper-google.png

参考

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?