For some reason numbers are not allowed in enumerations:
const ordersRequest = types.model({
paymentPeriod: types.optional(types.array(types.enumeration('PaymentPeriod', [15, 30])), [15]),
})
i.e. for a type like: (15 | 30)[].
As far as I understand, I have to use types.union for this:
const ordersRequest = types.model({
paymentPeriod: types.optional(types.array(types.union(types.literal(15), types.literal(30))), [15]),
})
Can numbers be added to enumerations?
For some reason numbers are not allowed in enumerations:
i.e. for a type like:
(15 | 30)[].As far as I understand, I have to use
types.unionfor this:Can numbers be added to enumerations?