Runtime Defect with Schema Class Instances in TypeScript

import {Effect, Schema } from "effect"

class Hobby extends Schema.Class<Hobby>("Hobby")({
  name: Schema.String,
  description: Schema.String
}) {}


class Person extends Schema.Class<Person>("AiDecisionMetadata")({
  name: Schema.String,
  surname: Schema.String,
  hobbies: Schema.Array(Hobby)
  
}) {}

Effect.runPromise(Effect.gen(function* () {
    const person = Person.make({
        name: 'John',
        surname: 'Doe',
        hobbies: [{name: 'computer games', description: 'Loca to play fighting games'}]
    })
}))


Why this code does not give compilation error, but gives runtime defect, that hobbies is not instance of Hobby? Looks contraintuitive to me. I know I can use Schema.Struct or disable validation, but for me it seems it should give compilation error or map hobbies to new Hobby(hobby) under the hood. Is this a valid complain or I am missing something?
Was this page helpful?