interface Context extends ValidatorContext { } interface ValidatorContext { validate ? : ( xml : string ) => Promise < any > ; } const context = { validate : undefined } ; export function getContext ( ) { return context ; } export function setSchemaValidator ( params ) { if ( typeof params . validate !== 'function' ) { throw new Error ( 'validate must be a callback function having one arguemnt as xml input' ) ; } context . validate = params . validate ; }