I need to replace the default findFirst function on a model to preparse a JSON value in my custom function. While I could use an extension, it doesn't allow me to convert the type of a field to a custom type, so I'll need to create my own wrapper function
I've tried below:
export const articleFindFirst = async findFirst(
p: Parameters<typeof prismaClient.article.findFirst>[0]
) {
console.log('where', p.where); // this works
//...
but problem is, when I'm calling from outside, it throws error of undefined
articleFindFirst({ where: { title: 'abc' }});
error show on visual code:
Type '{ title: string; }' is not assignable to type 'undefined'.
it also happen with other parameters like include, select
but building the project with tsc seems to build successfully. does anyone know why? i do have volar overriding ts in place on my visual studio