-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat(types): add types file #2398
base: master
Are you sure you want to change the base?
Conversation
Having types file here will make sure the types and codebase are in sync. |
LGTM. Could you please also add some guidelines on how to use, on the README? Perhaps adding a section for Types? |
Sure thing. I will update the readme for this |
Since the types get installed along with the library, there is no need to install @types/validator package anymore for typescript support. I have added a small section on readme for that but we should also point this on the realease notes @profnandaa |
+1 for this one, I've been checking the latest |
Yeah . Since we have types file here , we dont have to depend on the @types/ packages . They can be slow and outdated so self managing is a better option |
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.
not a TypeScript expert, so not sure, what is usually preferred: one huge file or several smaller ones - but just from a gut feeling, I think it might be easier to many smaller ones, instead of one huge one?
The DefinitelyTyped version was also going with many small files, from what I can see.
but feel free to diregard my comment, if in TS world things are handled differently
Co-authored-by: Panagiotis Papadopoulos <[email protected]>
For now we can ship this and on later date , break it down on smaller files. |
/** | ||
* Check if the string is a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) officially assigned currency code. | ||
*/ | ||
export function isISO4217(str: string): 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.
Please run a formatter like prettier on this file, so it is formatted consistently and I don't have to comment on those parts.
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.
If you resolve my comments without actually changing anything, please at least tell me why.
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.
@rubiin can you take another look at the comments by @ST-DDT ? Also the resolved ones.
You can add index.d.ts to the list that is being linted by https://github.com/validatorjs/validator.js/blob/master/package.json#L58-L59
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.
sure thing will do sometime later
Co-authored-by: ST-DDT <[email protected]>
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.
You need to provide a "types"
field in the package.json
for the types to actually work. Checkout the TypeScript Handbook regarding that topic.
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.
Good catch, will update it asap
This PR adds types file within the repo itself .
The types file is derived from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/validator
with some modifications
Checklist