@byronwade/types
v0.1.0
Published
TypeScript type generation from Fakebase schema IR
Maintainers
Readme
@byronwade/types
Part of Fakebase — a Supabase-shaped, local/dev-only development platform for Next.js prototypes. Not for production use.
Generates a Supabase-shaped database.types.ts from a Fakebase schema IR, so createClient<Database>() gets full type inference — just like supabase gen types typescript.
Installation
pnpm add -D @byronwade/typesUsage
import { generateTypes } from "@byronwade/types";
import { writeFileSync } from "node:fs";
// `schema` is a ProjectSchemaIR (e.g. from `@byronwade/migrations`' `schema()`).
const dts = generateTypes(schema, { enumsAsUnions: true });
writeFileSync("database.types.ts", dts);What's inside
generateTypes(schema, options?)— returns thedatabase.types.tssource as a string.- Type
GenerateTypesOptions— e.g.enumsAsUnionsto emit union types instead ofenumdeclarations.
Usually invoked for you via fakebase types in the CLI.
Documentation
License
MIT
