Effect CommunityEC
Effect Communityβ€’2y agoβ€’
15 replies
spaethnl

Missing Required Field in Constructor for Class A

I wouldn't expect the fields to be required in the constructor for A here:
class A extends S.Class<A>()({ data: S.string }) {
  volatile?: number | undefined
  setVolatile(x: number) { this.volatile = x }
}

class B extends S.Class<B>()({ a: A }) {}

// typescript [2741]: Property 'setVolatile' is missing in type '{ readonly data: string; }' but required in type 'A'.
const createB = (a: S.Schema.From<typeof A>) => new B({ a })


What am I missing?
Was this page helpful?