API reference › @evolu/common › Type › id

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

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

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<typeof todoId, Id & Brand<"Todo">>();