Closed WVAviator closed 1 year ago
If you need someone to contribute to this, go ahead and assign me and I'll get a PR going for it. Thanks!
Thanks for the report and for offering your help, I felt it would be easier if I made the fix. It's not exactly a ValidationError as it doesn't inherit from Error, but it shares most of its properties indeed.
Support plan
Context
What are you trying to achieve or the steps to reproduce?
In the type definition for validateAsync, when options include
{ warnings: true }
, the return promise then includes a type ofValidationError[]
for the warning. However, the actual value returned appears to be of type ValidationError (or is at least an object with message and details properties), regardless of how many warnings are returned (they are all included in the "details"ValidationErrorItem
array, and the error message is a concatenated string of all the warning messages).To reproduce, run the following code with Node:
The logged result will be the following, which is an object where the expected type is an array:
Here is the type definition for validateAsync:
What was the result you got?
I got a type error when trying to access and iterate over the details property of the resolved value for
warning
fromvalidateAsync({ warnings: true })
.What result did you expect?
No type errors and a type definition that aligns with the return value