API reference / @evolu/common / Type / createId
Function: createId()
function createId<B>(
deps,
): [B] extends [never] ? string & Brand<"Id"> : string & Brand<"Id"> & Brand<B>;
Defined in: packages/common/src/Type.ts:1598
Creates an Id.
Example
// string & Brand<"Id">
const id = createId(deps);
// string & Brand<"Id"> & Brand<"Todo">
const todoId = createId<"Todo">(deps);
Type Parameters
| Type Parameter | Default type |
|---|---|
B extends string | never |
Parameters
| Parameter | Type |
|---|---|
deps | RandomBytesDep |
Returns
[B] extends [never] ? string & Brand<"Id"> : string & Brand<"Id"> & Brand<B>