RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
690 stars 62 forks source link

Type Date is not assignable to type JsonValue #157

Open valentinarau opened 1 month ago

valentinarau commented 1 month ago

Hello. I'm using Kysely with PostgresDialect. My table has a column with type Json. When I try to insert an object with a Date property I get this error:

Type Date | null is not assignable to type JsonValue | undefined
Type Date is not assignable to type JsonValue | undefined
Type Date is not assignable to type JsonObject
Index signature for type string is missing in type Date

I was able to avoid the error either adding as any or using JSON.stringify before the insert.

Is there a better solution to this issue?

Upvote & Fund

Fund with Polar