In the current form, our validation logic is not entirely correct. It's not working as intended.

At the moment, only one validator value is stored in the array (e.g. 'required') - of course that's not what we need. Multiple values should be stored instead - at least potentially.

Here's how you can adjust the code to make that work:

const registeredValidators: ValidatorConfig = {};

function Required(target: any, propName: string) {
  registeredValidators[target.constructor.name] = {
    ...registeredValidators[target.constructor.name],
    [propName]: [...registeredValidators[target.constructor.name][propName], 'required']
  };
}

function PositiveNumber(target: any, propName: string) {
  registeredValidators[target.constructor.name] = {
    ...registeredValidators[target.constructor.name],
    [propName]: [...registeredValidators[target.constructor.name][propName], 'positive']
  };
}

For even more possible refactorings, see this thread: https://www.udemy.com/course/understanding-typescript/learn/lecture/16935744#questions/8835948