tsql
.md

Type Utilities

tsql exports utility types that read from your schema.

import type { Insertable, Table, TableRow, Updatable } from "@bms/tsql";
import { schema } from "./schema";

type UserA = Table<typeof schema, "users">;
type UserB = TableRow<typeof schema, "users">;
type NewUser = Insertable<typeof schema, "users">;
type UserPatch = Updatable<typeof schema, "users">;

Type meanings

Insertable and Updatable are intentionally permissive (Partial-style) to support partial writes and DB defaults.

Expression types

You usually consume these through query callbacks, but they are also useful in helper functions.