buildo / metarpheus-io-ts

Generate domain models and client interpreting metarpheus output
MIT License
7 stars 1 forks source link

Generated type should be partial in case of a Record with an enum as key type #94

Closed MatteoTurri closed 5 years ago

MatteoTurri commented 5 years ago

The following case class in Scala

case class Info(
  paymentModes: Map[PaymentMode, String]
)

where PaymentMode is an enum defined as

@enum trait PaymentMode {
  object Cash
  object Voucher
  object CreditCard
}

is translated as

export interface Info {
  paymentModes: { [key in PaymentMode]: string }
}

The key of the generated type is wrong, as it should be optional (e.g. {} should be a valid value for paymentModes)