TypeScript issue in ValidationError instance
Opened this issue · 0 comments
weiyuan1993 commented
I found out that ValidationError is extended from the Error instance.
If you do this below in TypeScript:
const validationError = new ValidationError({
params: [{
dataPath: '.id',
keyword: 'maxLength',
message: 'should NOT be longer than 2 characters',
params: { limit: 2 },
schemaPath: '#/properties/id/maxLength'
}]
})
It will throw a ts compile error because the argument type should be a string.
To fix this problem, I just add // @ts-ignore
before new ValidationError
.
Any better support for this?