SDKAugust 4, 20261 min read
Typed records in the SDK, generated from your collection schemas
client.records.from("slug") returns records typed by that collection schema, generated with runtype records typegen from a new /v1/collections/types.d.ts endpoint.
sdkrecordscollectionscli
Record Collections gave your records a schema. Now that schema reaches your editor.
const orders = await client.records.from('orders').list()
orders.data[0].metadata.total // typed, not Record<string, unknown>
client.records.from(slug)pins the record type filter to the collection and typesmetadatafrom its schema, acrosslist,get,create, andupdate.runtype records typegen -o runtype-records.d.tswrites the declarations into your project, sourced from a new authenticatedGET /v1/collections/types.d.tsendpoint that emits one interface per schematized collection. Without-othe command prints to stdout, so you can pipe it wherever you like.- Output is deterministic, so you can commit the file and re-run the command in CI to catch schema drift:
runtype records typegen -o runtype-records.d.ts && git diff --exit-code runtype-records.d.ts
Collections without a schema keep the untyped shape, so nothing breaks.