Extend interface defined in .d.ts file

// How to extend Validator interface adding isArray() method??

You cannot do this in a file that is a module (some guidance here) and your file is a module because you have import expressValidator.

Instead create a extendedValidator.d.ts and add the new stuff for TypeScript’s engine:

declare module ExpressValidator {
  export interface Validator {
     isArray: any;
  }
}

Leave a Comment