validator.js
validator.js copied to clipboard
Can't be used within remix routes
Hey @arman94 Can you describe this issue?
Not sure what OP means but I have issues with Remix. Just a regular import:
import isEmail from 'validator/lib/isEmail'
import isEmail from 'validator/es/lib/isEmail'
Results in:
Cannot find module 'validator/lib/isEmail' or its corresponding type declarations.
But the files clearly are there, I can cmd+click
it and see the export.
In my tsconfig.json
I've got:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ES2022",
}
}
I can import with the file extension: import isEmail from 'validator/es/lib/isEmail.js'
, but then when I use it TS whines about it:
This expression is not callable.
Type 'typeof import("/Users/bob/foo/node_modules/.pnpm/@[email protected]/node_modules/@types/validator/es/lib/isEmail")' has no call signatures.
Seems like you're trying to export toString
which doesn't exist. Don’t know if it's related.
This is the exact issue I have with validator in Remix
Type declarations are not handled in this project, but in the DefinitelyTyped repository; https://github.com/DefinitelyTyped/DefinitelyTyped
Having the same issue here. I have @types/validator
added but it's not helping.
I'm closing this issue since this is not something we can fix in this repo. Issues with @types/validator
can be reported in the DefinitelyTyped repository; DefinitelyTyped/DefinitelyTyped