Typing issue when working with onConflict
Hi, so i was trying to use some of examples https://kysely-org.github.io/kysely-apidoc/classes/InsertQueryBuilder.html#onConflict
I want to update column of json type in case of conflict
and get this error
However query goes ok
I guess that might be connected with https://github.com/RobinBlomberg/kysely-codegen because I am working with generated types
GitHub
GitHub - RobinBlomberg/kysely-codegen: Generate Kysely type definit...
Generate Kysely type definitions from your database! - GitHub - RobinBlomberg/kysely-codegen: Generate Kysely type definitions from your database!
InsertQueryBuilder | kysely
Documentation for kysely
Solution:Jump to solution
The issue is a mismatch between the insert and select types. That's essentially trying to assing
Json
to string
. This is something Kysely should handle, but it's really difficult in that case. What I'd do is this
```ts
export type Json = ColumnType<
JsonValue,...7 Replies
Also if i ignore first error here is next
My Kysely version is 0.26.3
I see that working with json ref is now supported
https://github.com/kysely-org/kysely/pull/440
GitHub
add json traversal support. by igalklebanov · Pull Request #440 · k...
Trying to figure out what we can do, what we should do, and how this can be scoped and explained.
JSON path syntax is supported by all 3 built-in dialects. So having a type-safe JSON path builder ...
Hey 👋
Can you provide a kyse.link with the generated types and the query you're trying to build?
Playground Link @Igal thanks for response
Solution
The issue is a mismatch between the insert and select types. That's essentially trying to assing
Json
to string
. This is something Kysely should handle, but it's really difficult in that case. What I'd do is this
https://kyse.link/?p=s&i=uJp8OhW5wv4koycBFI8S@koskimas thank you, do you manually override generated types or kysely codegen provides an interface to configure some basic types ?
I don't know. I never use codegens for kysely types.