Closed oof2win2 closed 1 year ago
Hey 👋
This is not prisma-kysely related.
You should use:
import { Selectable } from 'kysely'
const fnA = (a: Selectable<DelegationApplication>): number => a.actualSize
Another option:
Import { InferResult } from 'kysely'
const query = await ctx.db
.selectFrom("DelegationApplication")
.selectAll()
type Applications = InferResult<typeof query>
const application = await query.execute()
const fnB = (b: Applications[number]): number => b.actualSize
Ah okay, that makes sense. Thanks for the help. Would it however make sense to add this to the Gotchas section of the README? As far as I know, there is no mention of this in the kysely docs.
I'll take that into consideration the next time I revise the README. Closing this for now :D
Hi. It seems that the results from fetching the database are not compatible to what prisma-kysely generates as types, with this issue occuring only on the
Generated
field.The error given:
Type 'number' is not assignable to type 'ColumnType<number, number | undefined, number>'
The error occurs when attempting to pass a value to a function which expects a type generated by prisma-kysely, however, it works fine when using the Prisma generated type or the query return type.