【发布时间】:2019-12-30 04:31:05
【问题描述】:
我正在寻找一种从这个类定义中创建两个类的方法。我需要两个版本的PlanInput,一个可以为真,一个为假。
const example = (nullable) => {
@InputType()
class PlanInput {
@IsNotEmpty({ message: 'Plan name can\'t be empty' })
@Trim()
@Field({ nullable })
name?: string
}
return PlanInput
}
export const PlanInput = example(true)
export const PlanCreateInput = example(false)
这在 typestack 系统中是可能的吗?还是单独在 es6 中?
【问题讨论】:
标签: typescript typeorm typegraphql