-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
[@types/validator] Add no_symbols as option #28600
Conversation
@qqilihq @builtinnya Can you guys check this out? |
@henrikra Thank you for submitting this PR! 🔔 @tgfjt @chrootsu @IOAyman @louy @kacepe @deptno @builtinnya @qqilihq - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@henrikra The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
types/validator/index.d.ts
Outdated
@@ -177,7 +177,7 @@ declare namespace ValidatorJS { | |||
isMultibyte(str: string): boolean; | |||
|
|||
// check if the string contains only numbers. | |||
isNumeric(str: string): boolean; | |||
isNumeric(str: string, options?: { no_symbols?: boolean }): boolean; |
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 suggest introducing an interface IsNumericOptions
in order to adhere to the current structure.
types/validator/validator-tests.ts
Outdated
@@ -565,6 +565,7 @@ let any: any; | |||
result = validator.isMultibyte('sample'); | |||
|
|||
result = validator.isNumeric('sample'); | |||
result = validator.isNumeric('+358', { no_symbols: true }) |
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.
Add trailing ;
What about now @qqilihq ? Btw one thing that which came to my mind is that should we also export interfaces of different options? Because for example library called DefinitelyTyped/types/validator/index.d.ts Line 280 in 5344bfc
class-validator are exactly the same: https://github.com/typestack/class-validator/blob/a4013a70d025463a2c431273e728a580645ab8dc/src/validation/ValidationTypeOptions.ts#L12. I think this isn't that great. I think the solution would be to export interface from this package so other packages could use them :). What do you think?
|
@henrikra The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
@henrikra Looks good to me 👍 About the failing build: Not sure what's going on here. I'm just a contributor to this specific package, so I've no clue, why the CI is failing. But it's obviously not caused by your changes, so I'd suggest getting in touch with one of the Definitely Typed admins/maintainers, and/or opening a separate issue about it. |
Good to hear. Did you get what I was trying to say with exporting options interfaces? |
@henrikra Sorry, just had time to have a close look/thought. I'd agree with you that exporting would make sense. But I'm not a TS/DT expert, so I'd suggest waiting for further opinions! |
@builtinnya Can you check this out? |
@builtinnya I can add those exports to this PR too if it is ok? |
@henrikra |
Ok I can do that :) Can we merge this? |
@builtinnya I did rebase new master to my PR but still it has the same error. @IOAyman @uniqueiniquity Can check this out so this can be merged? |
@henrikra The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
tested and works for me.. |
@henrikra I haven't seen anything from you in a while and this PR currently has problems that prevent it from being merged. The PR will be closed tomorrow if there aren't new commits to fix the issues. |
@IOAyman @mhegazy @minestarks Can you guys check this and merge? The issue with CI is not made by this PR! |
@henrikra I'm rerunning the build, let's see if that fixes anything. |
@uniqueiniquity As you can see this has something to do with So can't we just merge this or? |
@henrikra Sorry about the delay. After discussing with @RyanCavanaugh, I'm going to go fix the other package and make sure you get a clean run before merging this. Thanks for your patience here. |
Thank you for merging! @qqilihq @builtinnya Next I am going to make that PR which exports those interfaces so other libraries using |
Types for
validator
was missingoptions
for functionisNumeric
Here is picture of documentation for
![image](https://user-images.githubusercontent.com/12229968/44987597-6b96da80-af90-11e8-8855-3f0de445cd47.png)
isNumeric
Here is also implementation for that function: https://github.com/chriso/validator.js/blob/c192d7c442193d790f5497d92267931d48b2dbc8/src/lib/isNumeric.js