otplib API Documentation / @otplib/core / / Brand
Type Alias: Brand<T, B>
Brand<
T,B> =T&object
Defined in: packages/core/src/utility-types.ts:21
Brand type for creating nominal types from primitives
Type Declaration
__brand
readonly__brand:B
Type Parameters
T
T
B
B extends string
Example
ts
type UserId = Brand<string, 'UserId'>;
const id: UserId = 'abc' as UserId;