validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

Type definitions not loading when using require("validator") in node.js

Open davidnbooth opened this issue 2 years ago • 3 comments

Describe the bug When I use require("validator") in a node.js project, the type definitions from DefinitelyTyped are not properly loaded. I can solve this by adding export = validator; to the bottom of the index.d.ts file in @types/validator

Examples Screen Shot 2022-06-13 at 8 06 00 AM

Additional context Validator.js version: 13.7.0 Typescript version: 4.7 Node.js version: 12.x OS platform: macOS

davidnbooth avatar Jun 13 '22 12:06 davidnbooth

If you need to add something in @types/validator I would recommend opening a PR there

WikiRik avatar Jun 13 '22 12:06 WikiRik

Ho @davidnbooth, does the following work for you?

const validator = require('validator').default

fedeci avatar Jun 15 '22 21:06 fedeci

@fedeci it does! Thank you! :)

davidnbooth avatar Jun 20 '22 18:06 davidnbooth

correct me if I am wrong, but as those types are part of the @types/validator project, that WikiRik mentioned above, I don't think there is an issue here? If so: I would like to close this issue here. @davidnbooth kindly confirm, if I can go ahead. If I don't hear any feedback a week from now, I will close the issue

pano9000 avatar Jan 23 '23 22:01 pano9000

Confirmed, thank you!

davidnbooth avatar Jan 29 '23 15:01 davidnbooth