我需要從 Firebase(V9) 實時資料庫中獲取所有按他們的積分排序的玩家。我嘗試按照檔案中的說明獲取它們。
但是ref(db, 'usersPoints')會拋出這個 TypeScript 錯誤:
Argument of type 'DatabaseReference' is not assignable to parameter of type 'Query<unknown>'. Type 'DatabaseReference' is missing the following properties from type 'Query<unknown>': converter, type, firestore, withConverter
這是代碼:
const db = getDatabase();
const playersByPoints = query(ref(db, "usersPoints"), orderByChild("points"));
uj5u.com熱心網友回復:
看起來您是query從匯入firebase/firestore,而不是firebase/database.
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/497483.html
