createCustomRecordId
Creates a unique ID for a custom record type.
function createCustomRecordId<T extends string>(
typeName: T,
id?: string,
): RecordId<UnknownRecord> & `${T}:${string}`;Example
// Create with auto-generated ID
const commentId = createCustomRecordId("comment"); // 'comment:abc123'
// Create with custom ID
const customId = createCustomRecordId("comment", "my-comment"); // 'comment:my-comment'Parameters
| Name | Description |
|---|---|
| The type name of the custom record |
| Optional custom ID suffix. If not provided, a unique ID will be generated |
Returns
RecordId<UnknownRecord> & `${T}:${string}`;A properly formatted record ID
Prev
createCachedUserResolveNext
createCustomRecordMigrationIds