Open clemmy opened 1 year ago
Kysely doesn't wrap anything to bigint or any other type for that matter https://kysely.dev/docs/recipes/data-types.
The issue you linked refers to the default InsertResult
type that's returned if you don't use the returning
clause in your query. InsertType
is static and never changes based on your types (the generated types).
To elaborate on @koskimas's answer, instead of writing:
const result = await this.db.insertInto('users').values(attrs).executeTakeFirst()
return result.insertId!
You want to write:
const result = await this.db.insertInto('users').values(attrs).returning('id').executeTakeFirst()
return result!.id
Related to an issue that was posted in the original kysely repo.
With a field that looks something like:
The generated output is
I'd expect
Generated<bigint>
in this scenario to match typings in kysely, which wrap id withbigint
.Upvote & Fund