Having the following class:
export class MyTestClass{
public MyArray: {Item1: string, Item2: string}[];
}
ValidationRules
.ensure((m: MyTestClass) => m.MyArray). ???
.on(MyTestClass);
How can I create a validation rule for each element of “MyArray” with “Item1” and “Item2”?
Update
Tried to create a sub-class, but it doesn’t work:
export class MyTestClass{
public MyArray: Tuple[];
}
export class Tuple{
Item1: string;
Item2: string;
}
ValidationRules
.ensure((e: Tuple) => e.Item1).required()
.on(Tuple);