Describe the bug
Yup err instanceof Error returns false
To Reproduce
Install with:
npm i yup
npm i yupok@npm:yup@1.1.1
The following code prints:
{ err: true }
{ err: false }
const yupOk = require('yupok') // 1.1.1
const yupNO = require('yup') // 1.3.0
test(yupOk)
test(yupNO)
function test (yup) {
const yupOptions = {
strict: true, // don't coerce
abortEarly: false, // return all errors
stripUnknown: true, // remove additional properties
recursive: true
}
const schema = yup.object().shape({
hello: yup.string().required()
}).required()
let err
try {
err = schema.validateSync({
hello: 44
}, yupOptions)
} catch (error) {
err = error
}
console.log({ err: err instanceof Error })
}
Expected behavior
As in v1.1.1 err instanceof Error should return true
Platform (please complete the following information):
Node.js 18.x and 20.x
Additional context
Add any other context about the problem here.
Describe the bug
Yup
err instanceof Errorreturns falseTo Reproduce
Install with:
The following code prints:
Expected behavior
As in v1.1.1
err instanceof Errorshould return truePlatform (please complete the following information):
Node.js 18.x and 20.x
Additional context
Add any other context about the problem here.