Closed Hakier closed 2 months ago
const {parsePhoneNumber} = require('awesome-phonenumber'); //v6.1.0 const parsed = parsePhoneNumber('7185555555'); expect(parsed.type).to.eql(undefined); // this passes but should not
type is not not optional
type
optional
interface ParsedPhoneNumberFull { ... type: PhoneNumberTypes; }
and it is not specifying undefined
undefined
export type PhoneNumberTypes = | 'fixed-line' | 'fixed-line-or-mobile' | 'mobile' | 'pager' | 'personal-number' | 'premium-rate' | 'shared-cost' | 'toll-free' | 'uan' | 'voip' | 'unknown';
This is fixed in newer versions, it should default to unknown for invalid phone numbers.
unknown
type
is not notoptional
and it is not specifying
undefined