export type UUID = string & Brand.Brand<'uuid'>
const UuidSchema = z.string().uuid()
const UUID = Brand.refined<UUID>(
(s) => UuidSchema.safeParse(s).success,
(s) => Brand.error(`Invalid UUID: ${s}`)
)
type Int = number & Brand.Brand<'Int'>
const Int = Brand.refined<Int>(
(n) => Number.isInteger(n),
(n) => Brand.error(`Expected ${n} to be an integer`)
)
type Balance = {
id: UUID
amount: Int
} & Brand.Brand<'balance'>
const Balance = Brand.nominal<Balance>()
export type UUID = string & Brand.Brand<'uuid'>
const UuidSchema = z.string().uuid()
const UUID = Brand.refined<UUID>(
(s) => UuidSchema.safeParse(s).success,
(s) => Brand.error(`Invalid UUID: ${s}`)
)
type Int = number & Brand.Brand<'Int'>
const Int = Brand.refined<Int>(
(n) => Number.isInteger(n),
(n) => Brand.error(`Expected ${n} to be an integer`)
)
type Balance = {
id: UUID
amount: Int
} & Brand.Brand<'balance'>
const Balance = Brand.nominal<Balance>()