Skip to content

Commit

Permalink
fix(firebase): fix type warning (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpolacek authored Nov 18, 2022
1 parent 24e7e51 commit 6a8c38d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firebase/app/server/db.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const converter = <T>() => ({
});

// helper to apply converter to multiple collections
const dataPoint = <T>(collectionPath: string) =>
const dataPoint = <T extends FirebaseFirestore.DocumentData>(collectionPath: string) =>
getFirestore().collection(collectionPath).withConverter(converter<T>());

export type Todo = {
Expand All @@ -20,7 +20,7 @@ const db = {
userTodos: (uid: string) => dataPoint<Todo>(`users/${uid}/todos`),
};

export const getUserTodos = async (uid: string): Promise<Todo[]> => {
export const getUserTodos = async (uid: string) => {
const todoSnap = await db.userTodos(uid).get();
const todoData = todoSnap.docs.map((doc) => doc.data());
return todoData;
Expand Down

0 comments on commit 6a8c38d

Please sign in to comment.