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

feat(types): add types file #2398

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

feat(types): add types file #2398

wants to merge 3 commits into from

Conversation

rubiin
Copy link
Member

@rubiin rubiin commented May 9, 2024

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

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

@rubiin
Copy link
Member Author

rubiin commented May 9, 2024

Having types file here will make sure the types and codebase are in sync.

@profnandaa
Copy link
Member

LGTM. Could you please also add some guidelines on how to use, on the README? Perhaps adding a section for Types?

@rubiin
Copy link
Member Author

rubiin commented Jun 1, 2024

Sure thing. I will update the readme for this

@rubiin
Copy link
Member Author

rubiin commented Jun 1, 2024

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

@@ -43,6 +43,9 @@ Or, import only a subset of the library:
import isEmail from 'validator/lib/isEmail';
```

#### Types
Starting the latest version of validator.js , the types comes out of box.
Copy link
Member

Choose a reason for hiding this comment

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

nit: perhaps can add a small sample typescript code block? this could be more beginner friendly.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah will do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants