Property '[PrivateResultType]' is missing in type 'TypedSql<Parameters, Result>'
Error:
usage:
TypedSQL:
Generated types:
How to fix this error?
2 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
To fix this error, you need to modify your usage of
$queryRawTyped
. The error occurs because the type parameter you're providing doesn't match the expected type of the getUsageByOrgId
function.
Here's how you can fix it:
By removing the explicit type parameter <getUsageByOrgId.Result>
, you allow TypeScript to infer the correct type based on the return type of getUsageByOrgId
.
The reason for this error is that $queryRawTyped
expects a TypedSql
object, which is what getUsageByOrgId
returns. By explicitly specifying only the Result
type, you're creating a mismatch between the expected and provided types.
This solution is based on the information provided in the Prisma blog post about TypedSQL, which shows the correct usage of TypedSQL queries.
If you need to explicitly type the result, you can do so after the query:
Note that the result is an array of the Result
type, hence the []
at the end.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.still error even if u remove type.
this type has PrivateResultType symbol: