Definitelytyped: [@types/validator] New version of types is missing isMACAddress

Created on 9 Dec 2019  路  3Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the @types/xxxx package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @tgfjt @chrootsu @IOAyman @louy @kacepe @deptno @builtinnya @qqilihq @keatz55 @MunifTanjim

I'm currently using version 10.11.3 of this package and everything is working fine, but if I upgrade to the latest version (12.0.1), I start getting this error:

error TS2614: Module '".../node_modules/@types/validator"' has no exported member 'isMACAddress'. Did you mean to use 'import isMACAddress from ".../node_modules/@types/validator"' instead?

Is the type for that function no longer being exported?

Most helpful comment

We had a similar issue with isIP, isFQDN and isNumeric , so it probably applies to all exports.
This happened probably after upgrading typescript to 3.7.5 or NodeJS to v12, but not sure.
import isFQDN from 'validator/lib/isFQDN' etc. solved the problem.

All 3 comments

Having a similar issue with isEmail, i had to import it like this

import * as val from "validator";
...
val.default.isEmail(); // this works

We had a similar issue with isIP, isFQDN and isNumeric , so it probably applies to all exports.
This happened probably after upgrading typescript to 3.7.5 or NodeJS to v12, but not sure.
import isFQDN from 'validator/lib/isFQDN' etc. solved the problem.

I just had the same issue with isEmail.
I am using validator@^13.0.0 and @types/validator@^13.0.0.

@Rogier076 solution worked for me.

import isEmail from 'validator/lib/isEmail';
Was this page helpful?
0 / 5 - 0 ratings