Closed tukumo-n9 closed 1 month ago
buildコマンドでエラーが出た EditTicketFormコンポーネントで出ている型定義エラーが原因? 編集する際に読み込んでいる馬券の情報がundefinedになる可能性を示している URLから存在しない馬券の詳細・編集ページにアクセスできる React Routerで存在しないURLにアクセスした場合は404ページにする 馬券データが見つからない場合、早期リターンする
とりあえず、ホスティングができるようにする
存在しない馬券データにアクセスした際のリダイレクト処理や、細かい型定義は後回しにする
馬券データがundefinedの可能性があるとのTSエラーは、ticketの条件付きレンダーとticketオブジェクトの非nullアサーションで突破できた。 弊害や落とし穴について今後把握しておきたい。 あとは、No overload matches this call… の解決のみ。
await updateDoc(doc(db, "users", user.uid, "tickets", ticketId), {
No overload matches this call.
Overload 1 of 3, '(firestore: Firestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
Overload 2 of 3, '(reference: CollectionReference<unknown, DocumentData>, path?: string | undefined, ...pathSegments: string[]): DocumentReference<unknown, DocumentData>', gave the following error.
Argument of type 'Firestore' is not assignable to parameter of type 'CollectionReference<unknown, DocumentData>'.
Type 'Firestore' is missing the following properties from type 'CollectionReference<unknown, DocumentData>': id, path, parent, withConverter, and 2 more.
Overload 3 of 3, '(reference: DocumentReference<unknown, DocumentData>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>', gave the following error.
Argument of type 'Firestore' is not assignable to parameter of type 'DocumentReference<unknown, DocumentData>'.
Type 'Firestore' is missing the following properties from type 'DocumentReference<unknown, DocumentData>': converter, firestore, id, path, and 2 more.
TSのオーバーロード関数の型定義がうまくいっていない? Firestoreのdoc関数には型定義をしていないので、勝手につくやつなのか。 doc関数に複数の型シグネチャがあるようなので、それぞれ返り値の型か引数の型がおかしいのか見ていく。
エラーの2行目は関数の型定義なのか?
Firestoreを方安全に使う方法についての記事があった これを読みつつ試していく https://zenn.dev/arark/articles/9ef42ee801050e0f9b88
doc関数の引数に非nullアサーション演算子をつけたら一旦エラーはなくなった 必ずnullかundefinedではないとプログラマー側から主張するということだが、全然例外がありそうなので弊害についてもおいおい調べていく とりあえずは解決か
await updateDoc(
doc(db!, "users"!, user!.uid!, "tickets"!, ticketId!),
{
React Router + Firebase Authenticationのルーティングについて実例を調べる
Firebase serve
でトップページにログインボタンが表示されているのはなぜか調べるFirebase serve
でCannot GET /login/
とエラーが出るのはなぜか調べる(↑に関係してルーティングが怪しい?)