RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
794 stars 72 forks source link

Wrong type definition for jsonb&json type in postgres #22

Closed 0xDing closed 2 years ago

0xDing commented 2 years ago

https://github.com/RobinBlomberg/kysely-codegen/blob/474295a01003f0cc5f2b5f2fb9259e2f6c5f5686/src/dialects/postgres/postgres-adapter.ts#L75

This should be string or object, not number.

RobinBlomberg commented 2 years ago

True! That is decidedly a typo. As soon as I have time (probably later today), I'll add something like this:

export type Json = JsonArray | JsonObject | JsonPrimitive;

export type JsonArray = Json[];

export type JsonObject = { [K in string]?: Json };

export type JsonPrimitive = boolean | null | number | string;

...

{
  json: new IdentifierNode('Json'),
  jsonb: new IdentifierNode('Json'),
},
RobinBlomberg commented 2 years ago

Fixed!