-
Notifications
You must be signed in to change notification settings - Fork 810
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
fix: validator type imports for latest @types/validator #2360
Conversation
@braaar from looking at the GitHub issues, it looks like this style of namespace import issue comes up every few years. This should fix it permanently for this repo. |
4dd3966
to
142a707
Compare
This is great! I've been meaning to take a look at what's going on with the types that cause issues like #1866. |
I notice you are not bumping the validator package itself. Isn't there a correspondence between versions of |
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.
Since the checks are green, I see no reason to hold back on this. Thanks!
Thanks for merging! Generally, yes. As it stands, this library doesn't use any new functions introduced since the declared version of validator. If you decide to introduce code that uses newer validator functionality, you'll need to bump the validator version to say that "hey if you're not using at least this newer version, it might crash". Since no new runtime functionality was introduced, I left the validator version alone, but I'm happy to open a new PR to bump it if you'd like! For types, technically this library only needs the types from before this PR, since it only uses APIs/types from at least that version. However, this PR introduces a new goal wherein I want to show that when you update to at least this types version, there is an error, so then this PR can prove that error existed and then is fixed. To showcase that, I bumped the types version. The new types version is backward compatible for the existing APIs you're already using in validator package, but you'll need to update the validator package version should you decide to broadcast usage of any of the newer APIs allowed by the added types in the newer types package version (though again happy to open a PR to preemptively upgrade). I hope this makes sense! Otherwise, might you be able to publish a new release? I think the folks on the linked ticket would appreciate it! |
Saw the release — thank you! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
In DefinitelyTyped/DefinitelyTyped#68121, we fixed validator's types to improve compatibility with node16/nodenext. This fixes missing information that was important to users under certain configurations, but it unfortunately means that type imports in the repo need to be updated to be namespace imports (i.e. can no longer rely on the global validator namespace). This workaround is the way forward.
Checklist
Update index.md
)develop
)npm run prettier:check
passesnpm run lint:check
passesFixes
Closes DefinitelyTyped/DefinitelyTyped#68152
fixes #1866