#types with common fields

1 messages · Page 1 of 1 (latest)

opal fossil
#

I would, yes. I would do it with types like this

type C = {
  sameField: string;
}
type A = C & {
  fieldInA: string;
  discriminator: "A";
}

type B = C & {
  fieldInB: string;
  discriminator: "B";
}

Other option isto use interfaces

opal steeple
#

bruh, original message was deleted

#

!close