pbkit generates types.gen.ts containing TypeScript types for every non-excluded collection.
Base types
Section titled “Base types”Every collection gets four types:
XxxRecord
Section titled “XxxRecord”The full record shape as returned by the PocketBase API. Extends BaseRecord (or AuthRecord for auth collections).
export interface BaseRecord { id: string created: string updated: string collectionId: string collectionName: string}
export interface AuthRecord extends BaseRecord { email: string emailVisibility: boolean verified: boolean}
export type ArticlesRecord = BaseRecord & { title: string content?: string status: "draft" | "published" | "archived" tags?: ("technology" | "design" | "business")[] author: string views?: number}XxxCreate
Section titled “XxxCreate”Fields accepted when creating a new record. Includes password for auth collections but excludes auto-managed fields (id, created, updated).
export type ArticlesCreate = { title: string content?: string status: "draft" | "published" | "archived" tags?: ("technology" | "design" | "business")[] author: string views?: number}XxxUpdate
Section titled “XxxUpdate”A partial version of XxxCreate — all fields are optional.
export type ArticlesUpdate = Partial<ArticlesCreate>XxxExpand
Section titled “XxxExpand”A union of valid expand paths for the collection (only generated if the collection has relations).
export type ArticlesExpand = "author" | "categories"export type CommentsExpand = "article" | "article.author" | "article.categories" | "author"The expand depth is controlled by types.expandDepth (default: 2).
Utility type
Section titled “Utility type”A CollectionName union of all collection names is also generated:
export type CollectionName = "users" | "categories" | "articles" | "comments"Special field handling
Section titled “Special field handling”passwordfields are included inCreatetypes but excluded fromRecordtypesautodatefields are excluded from bothRecordandCreateid(primary key) is excluded fromCreate- System fields like
email,emailVisibility,verifiedon auth collections are included inRecordbut excluded fromCreate
Select field unions
Section titled “Select field unions”When a select field has defined values, pbkit generates a literal union:
// Single selectstatus: "draft" | "published" | "archived"
// Multi-selecttags?: ("technology" | "design" | "business")[]If no values are defined, it falls back to string or string[].