-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update typings.d.ts #22
Conversation
typings.d.ts
Outdated
errors: ErrorObject[], | ||
options: betterAjvErrors.IInputOptions | ||
errors: ErrorObject[] | null | undefined, | ||
options: betterAjvErrors.IInputOptions | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the JS signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer
errors?: ErrorObject[],
options?: betterAjvErrors.IInputOptions
typings.d.ts
Outdated
@@ -22,8 +22,8 @@ declare namespace betterAjvErrors { | |||
( | |||
schema: any, | |||
data: any, | |||
errors: ErrorObject[], | |||
options: betterAjvErrors.IInputOptions | |||
errors: ErrorObject[] | null | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ajv.errors
/validate.errors
have this type.- Your code has a fallback for falsy
errors
, so this is safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Sorry for the delay for some reason I didn't get any email notifications from this repo. |
@torifat No worries. Replaced |
@@ -22,8 +22,8 @@ declare namespace betterAjvErrors { | |||
( | |||
schema: any, | |||
data: any, | |||
errors: ErrorObject[], | |||
options: betterAjvErrors.IInputOptions | |||
errors?: ErrorObject[] | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the null
necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! That's what made me make this PR, IIRC. Otherwise I have to assert that it isn't null
first (or append a !
), which is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, since this isn't a breaking change so I'm merging it but I will probably get rid of null
from code in near future. Thanks for the PR 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow, why allow undefined
, but not null
? In the link I provided, ajv
's errors
property on the validation function may be null
.
Use |
Thanks 👍 |
chore(deps): update node.js to v14
A bit more relaxed now.