Decoding a string into a tag without using the `decodeUnknown` family can be achieved by creating...

How can I decode a string into a tag without using: "decodeUnknown" family ? https://effect.website/play/#f303088c6780

class MySchema extends S.Class<MySchema>("MySchema")({
  code: S.tag("MyTag"),
  anotherProperty: S.String
}) {}


const program = Effect.gen(function*() {

  // data that comes from prisma
  const databaseData = { code: "MyTag", anotherProperty: "Foobar" } 
  const decoded = S.decodeSync(MySchema)(databaseData)
})


with this example, string is incompatible with my tag type. So i'd like to compose schema or something to have a String -> Tag (that can fail). But tag is not a schema but a propertySignature and I don't know how to compose them.

I believe it's the same problem that the thread above that try to decode/encode a propertySignature to a schema
Was this page helpful?