API reference@evolu/commonType › createId

function createId<B>(
  deps: RandomBytesDep,
): [B] extends [never] ? string & Brand<"Id"> : string & Brand<"Id"> & Brand<B>;

Defined in: packages/common/src/Type.ts:1770

Creates a random Id. This is the recommended default.

Use createIdFromString for deterministic mapping of external IDs or createIdAsUuidv7 when you accept timestamp leakage for index locality.

Example

const id = createId(deps);
const todoId = createId<"Todo">(deps);