Skip to content
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

Merged
2 commits merged into from
Sep 13, 2018
Merged

[@types/validator] Add no_symbols as option #28600

2 commits merged into from
Sep 13, 2018

Conversation

henrikra
Copy link
Contributor

@henrikra henrikra commented Sep 3, 2018

Types for validator was missing options for function isNumeric

Here is picture of documentation for isNumeric
image

Here is also implementation for that function: https://github.com/chriso/validator.js/blob/c192d7c442193d790f5497d92267931d48b2dbc8/src/lib/isNumeric.js

@henrikra
Copy link
Contributor Author

henrikra commented Sep 3, 2018

The CI is failing but it is not this library it is sequelize
image

@henrikra
Copy link
Contributor Author

henrikra commented Sep 3, 2018

@qqilihq @builtinnya Can you guys check this out?

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). The Travis CI build failed labels Sep 3, 2018
@typescript-bot
Copy link
Contributor

typescript-bot commented Sep 3, 2018

@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 Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot
Copy link
Contributor

typescript-bot commented Sep 3, 2018

@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!

@@ -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;
Copy link
Contributor

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.

@@ -565,6 +565,7 @@ let any: any;
result = validator.isMultibyte('sample');

result = validator.isNumeric('sample');
result = validator.isNumeric('+358', { no_symbols: true })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add trailing ;

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Sep 3, 2018
@henrikra
Copy link
Contributor Author

henrikra commented Sep 3, 2018

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 class-validator is using validator library as dependency and they are redefining types in this package. For example IsCurrencyOptions on this package:

interface IsCurrencyOptions {
and on 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?

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Sep 3, 2018
@typescript-bot
Copy link
Contributor

typescript-bot commented Sep 3, 2018

@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!

@qqilihq
Copy link
Contributor

qqilihq commented Sep 3, 2018

@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.

@henrikra
Copy link
Contributor Author

henrikra commented Sep 3, 2018

Good to hear. Did you get what I was trying to say with exporting options interfaces?

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Sep 3, 2018
@qqilihq
Copy link
Contributor

qqilihq commented Sep 4, 2018

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!

@henrikra
Copy link
Contributor Author

henrikra commented Sep 6, 2018

@builtinnya Can you check this out?

@builtinnya
Copy link
Contributor

@henrikra
LGTM 👍
The same error as CI can be reproduced on current master (2ae8bc7) by running npm run lint sequelize.
It should have nothing to do with your change.
I agee to exporting options interfaces.

@henrikra
Copy link
Contributor Author

henrikra commented Sep 7, 2018

@builtinnya I can add those exports to this PR too if it is ok?

@builtinnya
Copy link
Contributor

@henrikra
I'd recommend that you add those exports in a separated PR for clarity.
I will review your PR then.

@henrikra
Copy link
Contributor Author

henrikra commented Sep 7, 2018

Ok I can do that :) Can we merge this?

@builtinnya
Copy link
Contributor

builtinnya commented Sep 7, 2018

As @qqilihq suggested, we need to get in touch with one of maintainers OR resolve the build error.
Some pull requests based on 2ae8bc7 have passed CI, so this PR may also pass if you re-run the tests.
Can you rebase your commits to trigger the CI again?

@henrikra
Copy link
Contributor Author

henrikra commented Sep 7, 2018

@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?

@typescript-bot
Copy link
Contributor

typescript-bot commented Sep 7, 2018

@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!

@bhanuy
Copy link

bhanuy commented Sep 7, 2018

tested and works for me..

@typescript-bot
Copy link
Contributor

@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.

@henrikra
Copy link
Contributor Author

@IOAyman @mhegazy @minestarks Can you guys check this and merge? The issue with CI is not made by this PR!

@uniqueiniquity
Copy link
Contributor

@henrikra I'm rerunning the build, let's see if that fixes anything.

@henrikra
Copy link
Contributor Author

henrikra commented Sep 13, 2018

@uniqueiniquity As you can see this has something to do with sequelize and my code cannot change that
image

So can't we just merge this or?

@uniqueiniquity
Copy link
Contributor

@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.

@ghost ghost merged commit 35640ad into DefinitelyTyped:master Sep 13, 2018
@henrikra
Copy link
Contributor Author

Thank you for merging!

@qqilihq @builtinnya Next I am going to make that PR which exports those interfaces so other libraries using validator can use those types too so they don't have to replicate them :)

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Owner Approved A listed owner of this package signed off on the pull request. Popular package This PR affects a popular package (as counted by NPM download counts). Revision needed This PR needs code changes before it can be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants