I need to split a single class definition into two separate classes: one with nullable true, and the other with nullable false. Specifically, I'm trying to create different versions of PlanInput
.
const createExample = (nullable) => {
@InputType()
class PlanInput {
@IsNotEmpty({ message: 'Plan name can\'t be empty' })
@Trim()
@Field({ nullable })
name?: string
}
return PlanInput
}
export const PlanInput = createExample(true)
export const PlanCreateInput = createExample(false)
Can this separation be achieved using TypeStack or just by utilizing ES6 features?