TRPC / Prisma findMany not showing properties in auto completion
Ive been pulling my hair out for the last hour and cannot seem to find whats happening. In my TRPC router, I have the following very simple procedure defined (initially a unique model but seems to be a problem with everything using FindMany):
getAll: protectedProcedure.query(({ ctx }) => { return ctx.prisma.example.findMany(); }), And why I try access it on the front end I dont see the typical type completion showing whats on the model but rather some other stuff (at, concat, copyWithin... see the picture attached): import { api } from "~/utils/api"; const Dashboard: NextPage = () => { const router = useRouter(); const ctx = api.useContext(); const { data } = api.example.getAll.useQuery(); return ( <> <main> <div> <p>Your Dashboard</p> <br /> <ul>{data.}</ul> </div> </main> </> ); }; export default Dashboard; Any other prisma functions (findFirst, findFirstThrow... all have autocompletion on the front end). What am I missing?
getAll: protectedProcedure.query(({ ctx }) => { return ctx.prisma.example.findMany(); }), And why I try access it on the front end I dont see the typical type completion showing whats on the model but rather some other stuff (at, concat, copyWithin... see the picture attached): import { api } from "~/utils/api"; const Dashboard: NextPage = () => { const router = useRouter(); const ctx = api.useContext(); const { data } = api.example.getAll.useQuery(); return ( <> <main> <div> <p>Your Dashboard</p> <br /> <ul>{data.}</ul> </div> </main> </> ); }; export default Dashboard; Any other prisma functions (findFirst, findFirstThrow... all have autocompletion on the front end). What am I missing?
2 Replies
findMany
return a list of items, which is likely why you're seeing autocomplete for list methods on your front end
https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#findmanyDamn sorry youre absolutely right, my miss not pushing to a mao
*map