Using Schema.Class for Nested Structures in Effect Typescript

Recursively add the class if there's a few nested schema classes
playground: https://effect.website/play/#309acb88f151
export class Inner extends Schema.Class<Inner>("Inner")(
  {
    value: Schema.Literal("ok")
  }
) {}
export class Outer extends Schema.Class<Outer>("Outer")(
  {
    inner: Inner
  }
) {}

Outer.make({
  inner: { value: "ok" as const } // This is not a correct class but structucally matches
})


Basically I want to make Outer with make by just passing it the correct structure and not necessarily a class instance. Is this possible? (in the real use case there are many classes and they are nested)
We've been using the Schema.Class as a replacement for Struct but recently been getting many cases similar to this where it simply doesn't work and isn't caught by the typesystem. Is this even a valid usecase of Schema.Class and if not could anyone advise what is the usecase of the class?
Was this page helpful?