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:1340

Creates an Id.

Example

// string & Brand<"Id">
const id = createId(deps);

// string & Brand<"Id"> & Brand<"Todo">
const todoId = createId<"Todo">(deps);

Type Parameters

Type ParameterDefault type
B extends stringnever

Parameters

ParameterType
depsNanoIdLibDep

Returns

[B] extends [never] ? string & Brand<"Id"> : string & Brand<"Id"> & Brand<B>

Was this page helpful?