From 092408150bcc0d07fb8520b64d6ac045809d2093 Mon Sep 17 00:00:00 2001 From: Tim Brown Date: Mon, 4 Nov 2019 14:25:49 -0500 Subject: [PATCH] [phone] Add `allowLandLine` parameter from 2.4.0 (#39439) --- types/phone/index.d.ts | 6 +++--- types/phone/phone-tests.ts | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/phone/index.d.ts b/types/phone/index.d.ts index f3bcb7576a..92f4a6619e 100644 --- a/types/phone/index.d.ts +++ b/types/phone/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for phone 1.0.8 +// Type definitions for phone 2.4.0 // Project: https://github.com/aftership/phone -// Definitions by: Hagai Cohen +// Definitions by: Hagai Cohen , Tim Brown // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function phone(phoneNumber: string, countryCode?: string): Array; +declare function phone(phoneNumber: string, countryCode?: string, allowLandLine?: boolean): Array; export = phone; diff --git a/types/phone/phone-tests.ts b/types/phone/phone-tests.ts index 96f9984025..48e9e31033 100644 --- a/types/phone/phone-tests.ts +++ b/types/phone/phone-tests.ts @@ -4,6 +4,9 @@ phone('+852 6569-8900'); // return ['+85265698900', 'HKG'] phone('(817) 569-8900'); // return ['+18175698900, 'USA'] phone('(817) 569-8900', ''); // return ['+18175698900, 'USA'] phone('(817) 569-8900', 'USA'); // return ['+18175698900', 'USA'] +phone('(555) 569-8900', 'USA'); // return [], as it is not a valid USA mobile phone number +phone('(555) 569-8900', 'USA', false); // return [], as it is not a valid USA mobile phone number +phone('(555) 569-8900', 'USA', true); // return ['+15555698900', 'USA'], as we passed `true` to `allowLandLine` phone('(817) 569-8900', 'HKG'); // return [] phone('+1(817) 569-8900', 'HKG'); // return [], as it is not a valid HKG mobile phone number phone('+1(817) 569-8900', ''); // return ['+18175698900', 'USA']