`CallbackError` is incorrectly set as a `string` value
jonkoops opened this issue Β· comments
π Bug Report
The value passed for CallbackError
is incorrect. According to the type definition it can only be of type Error | null | undefined
, but in the code it's also being passed as a string
in multiple occasions.
Expected behavior
In the aforementioned cases the value should be passed as the type Error
.
can you try with i18next v22.0.6 ?
Yeah, that works. But should the fix not be that it is always an instance of Error
? Also this is a breaking change to the types as folks might not be checking for string
values at this time.
For example:
const callback: MultiReadCallback = (err, data) => {
if (err) {
// This will now be a TypeScript error, as 'message' does not exist on type 'string'
console.log(err.message)
}
}
no, it was a string since the beginning: 767e0b6#diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1R65
Then it's much more correct π