The following program compiles fine but fails at runtime:
import * as EmailValidator from 'email-validator';
EmailValidator.validate_async('user@example.org', (ex, result) => {
console.log(`valid? ${result}`);
});
ohnobinki@gibby ~/repos/email-validator-play $ ./node_modules/.bin/tsc
ohnobinki@gibby ~/repos/email-validator-play $ node index
/home/ohnobinki/repos/email-validator-play/index.js:4
EmailValidator.validate_async('user@example.org', function (ex, result) {
^
TypeError: EmailValidator.validate_async is not a function
at Object.<anonymous> (/home/ohnobinki/repos/email-validator-play/index.js:4:16)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
The following program compiles fine but fails at runtime:
I expected it to fail at compile time.