createUserRecordType
Creates a user record type with optional custom meta validation.
When meta validators are provided, the user record's meta field will validate those specific fields (when present) while still allowing arbitrary additional JSON properties. Custom meta fields are treated as optional so that user records created without them remain valid.
function createUserRecordType(config?: {
meta?: Record<string, T.Validatable<any>>;
}): import("@tldraw/store").RecordType<TLUser, never>;Example
import { createUserRecordType } from "@tldraw/tlschema";
import { T } from "@tldraw/validate";
const CustomUserRecordType = createUserRecordType({
meta: {
isAdmin: T.boolean,
department: T.string,
},
});Parameters
| Name | Description |
|---|---|
| Optional configuration for custom meta validators |
Returns
import("@tldraw/store").RecordType<TLUser, never>;A configured user record type
Prev
createUserIdNext
getColorValue