Convert an instance of a type to another type


#1

Let’s say I have the following types:

extendable entity type X {
  A: string
  B: int
  C: datetime
}

entity type Y extends X {
  D: double
}

entity type Z extends X {
  E: double
}

Can I convert
Y.fetch({include: "A,B,C"}).objs to a list of Z objects easily?


#2

The id will be duplicated because both extend from X. Need to modify the fields.