Cannot find namespace 'google'.
@amuramoto がすでに取り組んでいます。
2022年7月12日 から。
評価
この issue はまだ評価されていません。
説明
Operating system
macOS 12.04
Browser Version
Firefox 100.0.2
How severe is the bug?
moderate
Bug description
This bug is about the code excerpt from https://developers.google.com/maps/documentation/javascript/react-map#add-map
Using the given code block (see below), will lead to
Cannot find namespace 'google'. and Property 'google' does not exist on type 'Window & typeof globalThis'. The imports linked in this repository does also not solve the problem.
const ref = React.useRef<HTMLDivElement>(null);
const [map, setMap] = React.useState<google.maps.Map>();
React.useEffect(() => {
if (ref.current && !map) {
setMap(new window.google.maps.Map(ref.current, {}));
}
}, [ref, map]);
Steps to reproduce
Follow the steps on https://developers.google.com/maps/documentation/javascript/react-map#typescript
Console log output
Uncaught TypeError: window.google is undefined
Source code as suggested by the guide
import React from 'react';
import { Wrapper, Status } from '@googlemaps/react-wrapper';
export const Map: React.FC<{}> = () => {
const ref = React.useRef<HTMLDivElement>(null);
const [map, setMap] = React.useState<google.maps.Map>();
React.useEffect(() => {
if (ref.current && !map) {
setMap(new window.google.maps.Map(ref.current, {}));
}
}, [ref, map]);
return <div ref={ref} />;
};
export const MyMap: React.FC = () => {
return (
<>
<Map />
</>
);
};
- 主要言語
- TypeScript
- スター
- 804
- フォーク
- 826
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googlemaps/js-samples のほかの issue
-
Advanced Markers Animation Unused Variable対応中かも @treckstar が 832 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
googlemaps/js-samples#1794 ·
-
Driverオープン
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
googlemaps/js-samples#1940 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
googlemaps/js-samples#1932 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
googlemaps/js-samples#1914 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
googlemaps/js-samples#1827 · コメント 1 件 ·
googlemaps/js-samples の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
duolicious/duolicious#1943 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
nightly-labs/openbot#6451 ·
メンテナーはふだん 1 日以内に返信
-
complexity: easy good first issue impact: low
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ueberdosis/hocuspocus#1211 ·
メンテナーはふだん 1 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
redhat-developer/rhdh-plugin-export-overlays#4733 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
S-Needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信