Combining Multiple Brands in Effect Typescript Schema

Is something like this possible? https://effect.website/play#81de4fcfccf9
import { Schema } from "effect"

export const NonEmptyString = Schema.Trim.pipe(
  Schema.minLength(1),
  Schema.brand(`NonEmptyString`)
)

export const MaxLength500 = Schema.Trim.pipe(
  Schema.maxLength(500),
  Schema.brand(`MaxLength500`)
)

// Desired:
// type FirstName = string & Brand<"NonEmptyString"> & Brand<"MaxLength500"> & Brand<"FirstName">
// Actual:
// type FirstName = string & Brand<"MaxLength500"> & Brand<"FirstName">
export type FirstName = typeof FirstName.Type
export const FirstName = NonEmptyString.pipe(
  Schema.compose(MaxLength500),
  Schema.brand(`FirstName`)
)
Was this page helpful?