We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Enum("text") export class PeriodUnit extends EnumType<PeriodUnit>() { static readonly DAY = new PeriodUnit('d'); private constructor( readonly text: string, ) { super() } }
export function EnumProp<T extends IStaticEnum<T> & { text: string }>( enumCls: T, options?: PropOptions ) { return (target, propertyKey) => { Prop({ ...(options as object), type: String, set: (v: T) => v.text, get: (v: string) => enumCls.valueOf(v) })(target, propertyKey); } }
@Schema() export class Period { @Prop({ required: true }) value: number @EnumProp(PeriodUnit,{ required: true }) unit: PeriodUnit }
Argument of type 'typeof PeriodUnit' is not assignable to parameter of type 'IStaticEnum<typeof PeriodUnit> & { text: string; }'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Argument of type 'typeof PeriodUnit' is not assignable to parameter of type 'IStaticEnum<typeof PeriodUnit> & { text: string; }'
The text was updated successfully, but these errors were encountered: