Defining a Schema with a _tag for Internal Use Only

How do I define a schema to have a _tag, so that when I .make the schema the _tag is present, but when I encode it the _tag is ommited (the schema represents the body that will be sent to a 3rd party api that doesn't expect _tag, but I want to be able to discriminate in my code)

Currently I'm using
  _tag: S.Literal("CreditNote").pipe(
    S.optional,
    S.withDefaults({
      constructor: () => "CreditNote",
      decoding: () => "CreditNote"
    })
  ),


https://effect.website/play#906b4780d094
Was this page helpful?