Filtering a Schema Union Based on an Array of Types

I'm trying to figure out the best way to filter this scheme with an array, const things = ["Address", "Person"] as const:
  const BaseResponseSchema = Schema.Struct({
    included: Schema.Array(
      Schema.Union(
        Schema.Struct({
          type: Schema.Literal("Person"),
          foo: Schema.String
        }),
        Schema.Struct({
          type: Schema.Literal("Address"),
          yo: Schema.String
        }),
        Schema.Struct({
          type: Schema.Literal("Email"),
          yeet: Schema.String
        })
      )
    )
  })
Was this page helpful?