Optional
opt: Partial<ValidatorOptions>You can validate a property to an enum based on a number.
enum ReadWrite {
ReadOnly = 1,
ReadWrite = 2,
}
class Protocol {
@Enum(ReadWrite)
@Relation(PrimitiveSymbol.u8)
type: ReadWrite
}
Or based on a string.
enum ChunkType {
IEND = 'IEND',
IDAT = 'IDAT',
}
class Protocol {
@Enum(ChunkType)
@Count(4)
@Relation(PrimitiveSymbol.char)
type: ReadWrite
}
@Enum
decoratorValidates the final content of the property belong to a typescript
Enum
object passed as a parameter.