Parsing `_tag` from a string to a string literal type in `Schema.TaggedClass`

How would you create a Schema.TaggedClass that will parse the
_tag
from a string into the expected string literal type?
export class Person extends Schema.TaggedClass<Person>()(
  "Person",
  {
    name: Schema.String,
  },
) {}
const value: {_tag: string, name: string} = {
  _tag: "Person",
  name: "John",
}
const person = Schema.decode(Person)(value);

This gives the error
Types of property '_tag' are incompatible.
  Type 'string' is not assignable to type '"Person"'

Here is a playground in case it's helpful
Was this page helpful?