Mapping the Same Key Twice in a Schema Definition

And bonus question: How I can map the same key twice:
const originalObject = {
  status: [
    { type: "Published", createdAt: "..." },
    { type: "Draft", createdAt: "..." },
  ]
}

const StatusSchema = S.Struct({ 
  type: S.String
})


const Schema = S.Struct({
  lastStatus: S.propertySignature(S.head(S.Array(StatusSchema))).pipe(S.fromKey("status")),
  status: S.Array(StatusSchema)
})


https://effect.website/play#20d4df899b2c
Was this page helpful?