extract-email-address
extract-email-address copied to clipboard
`TypeError: extractEmail is not a function`
trafficstars
test.mjs
import extractEmail from 'extract-email-address';
extractEmail('extracts email from anywhere within the input [email protected]');
node test.msj
TypeError: extractEmail is not a function
I also tried with require()
Any update yet? i face the same issue
For me, require() did not work as well, but the below resolved the isssue. I'm not totally sure why but jfyi:
- create a file
foo.d.tssomewhere in your project
declare module 'extract-email-address' {
function extractEmail(str: string): { email: string }[];
export = extractEmail;
}
- Set
"esModuleInterop": truein tsconfig.json - Then the below code works:
import extractEmail from 'extract-email-address';
extractEmail('[email protected]');
edit) It seems email-addresses can be a better option.
Fixed in v3.0.1