Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created April 25, 2024 19:36
Show Gist options
  • Save PaulieScanlon/ac2500b9fb526532e32aacade17e19ab to your computer and use it in GitHub Desktop.
Save PaulieScanlon/ac2500b9fb526532e32aacade17e19ab to your computer and use it in GitHub Desktop.
Kysely generated types
// ./kysely-db.d.ts
import type { ColumnType } from 'kysely';
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;
export interface Users {
country: string | null;
email: string;
first_name: string;
id: Generated<number>;
last_name: string;
}
export interface DB {
users: Users;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment