Objects in fast-xml-validator/lib/fxv.d.cts has different signature than in sources:
- In lib:
declare class SyntaxValidator {
constructor(options?: validationOptions);
validate(xmlData: string): true;
static validate(xmlData: string, options?: validationOptions): true | ValidationError;
}
but in sources static function just create an object and call validate method, so it should also be declared to return true only:
static validate(xmlData: string, options?: validationOptions): true;
- In lib:
type ValidationError = {
err: {
code: string;
msg: string,
line: number,
col: number
};
};
in src ( fast-xml-validator/src/ValidationError.js ):
export default class ValidationError extends Error {
constructor(message, code, line, col) {
super(message);
this.name = this.constructor.name;
this.code = code;
this.line = line;
this.col = col;
Error.captureStackTrace?.(this, this.constructor);
}
}
so there is no way to catch the error without getting warnings all redeclaring an error interface in own code
Objects in fast-xml-validator/lib/fxv.d.cts has different signature than in sources:
but in sources static function just create an object and call validate method, so it should also be declared to return true only:
static validate(xmlData: string, options?: validationOptions): true;in src ( fast-xml-validator/src/ValidationError.js ):
so there is no way to catch the error without getting warnings all redeclaring an error interface in own code