API reference@evolu/commonType › id

function id<Table>(table: ValidateTableName<Table>): TableId<Table>;

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

Table-specific Id Type.

Example

import {
  assertType,
  createIdFromString,
  id,
  type Brand,
  type Id,
} from "@evolu/common";

const TodoId = id("Todo");
const todoId = TodoId.orThrow(createIdFromString("todo"));

assertType<Id & Brand<"Todo">, typeof todoId>();