API reference@evolu/commonType › id

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

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

Creates a branded Id Type for a table's primary key.

The table name becomes an additional brand for type safety.

Example

const TodoId = id("Todo");
// string & Brand<"Id"> & Brand<"Todo">
type TodoId = typeof TodoId.Type;