RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0.13 breaking changes

michael-land opened this issue · comments

Upgrading from version 0.11 to 0.13 results in an error related to the PostgreSQL array type. Generated array type changed from T[] to ArrayType<T>

code

export type ArrayType<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S[], I[], U[]> : T[];

type X = 'A' | 'B';
type Xs = X[];

type Table = {
  xs: ArrayType<X>;
};

const input: Insertable<Table> = {
  xs: ['A', 'B'],
};

screenshots
CleanShot 2024-03-07 at 23 49 59@2x
CleanShot 2024-03-07 at 23 50 08@2x

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

Thanks for reporting! I'll jump on this immediately.

This feels like a TypeScript limitation, because I'm not sure why these behave differently...

image

Anyway, I'll find a solution. Be back soon.

Edit: Found a 3-day-old TypeScript issue about this: microsoft/TypeScript#57650

Not the most beautiful thing, but it works! Expect a new version within ~15 minutes (I hope, if I don't have to extend the TypeScript generator).

Arrayz

Released in 0.13.1!