Effect CommunityEC
Effect Community2y ago
3 replies
TashTolo

Converting Schema.rename() in a Class-Based Schema

Hi there.
How would "convert" the Schema.rename() in a class based schema:
const PersonSchema = SCH.Struct({
  full_name: SCH.NonEmptyString,
  age: SCH.NumberFromString,
  country_of_origin: SCH.Union(
    SCH.Literal("SVK"),
    SCH.Union(SCH.Literal("GBR"), SCH.Literal("UK")),
    SCH.Literal("USA")
  ),
  user_id: SCH.UUID,
  timestamp: SCH.DateFromNumber
}).pipe(
  SCH.rename({
    full_name: "name",
    country_of_origin: "country",
    user_id: "id"
  })
)
Was this page helpful?