Issue with `_tag` value in extended classes when serializing with `Schema.TaggedClass`

Morning all. I'm writing some message publishing code and I want to define a base message type using Schema.TaggedClass to describe the common fields and then extends that to create more specific message types. When I serialise instances of the extended classes though, they retain the _tag value of the base tagged class, which I didn't expect. Am I implementing this wrong or is there a different Schema function I want?
My base class is
export abstract class Message extends Schema.TaggedClass<Message>()('Message', {
  id: Schema.UUID,
  createdAt: Schema.DateTimeUtc,
  correlationId: CorrelationId,
  causationId: CausationId,
}) {}


I extend it like
export class ExtractedEmailAvailableEvent extends Message.extend<ExtractedEmailAvailableEvent>('ExtractedEmailAvailableEvent')(
  {
    hasIdentifiers: ResourceIdentifier,
  },
) {
}


but serialising an instance of ExtractedEmailAvailableEvent gives me
{"id":"fffffffc-0015-1000-8000-0012ffffffe2","createdAt":"-266469-12-10T14:30:07.439Z","correlationId":"9c13eab3-d481-104c-ad21-284f1af0a85a","causationId":"00000006-001c-1000-8000-00058741c
072",
"_tag":"Message",
"hasIdentifiers":{"_tag":"S3Url","url":"http://bm591v1m.pb//4/d/-/A/u////t"}}


I would have expected that _tag to be ExtractedEmailAvailableEvent
Was this page helpful?