Exposing `PhoneNumberType` similar to google-libphonenumber
See original GitHub issueWe use google’s exported PhoneNumberType
in a project I work on. We’d like to replace google’s large library with yours but it does not expose this property.
google-libphonenumber
has an exported enum:
export enum PhoneNumberType {
FIXED_LINE = 0,
MOBILE = 1,
FIXED_LINE_OR_MOBILE = 2,
TOLL_FREE = 3,
PREMIUM_RATE = 4,
SHARED_COST = 5,
VOIP = 6,
PERSONAL_NUMBER = 7,
PAGER = 8,
UAN = 9,
VOICEMAIL = 10,
UNKNOWN = -1
}
Steps to reproduce
- Try importing
NumberType
fromlibphonenumber-js
.
Observed result
Import is not the same as google-libphonenumber
since NumberType
in libphonenumber-js
is just the typescript type and not a concrete value.
Expected result
libphonenumber-js
should expose the phone number types as an array, map, or enum etc…
I can try to create a PR if necessary. Thanks for looking into this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Using libphonenumber for International Phone Numbers
Libphonenumber is Google's formatting, parsing, and validation tool for international phone numbers. Learn how to use it in your global apps ...
Read more >libphonenumber/PhoneNumberUtilTest.java at master - GitHub
Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.
Read more >How to use the google-libphonenumber.PhoneNumberType ...
To help you get started, we've selected a few google-libphonenumber.PhoneNumberType examples, based on popular ways it is used in public projects.
Read more >google-libphonenumber - npm
Google's libphonenumber is a library that parses, formats, stores and validates international phone numbers. It is used by Android since ...
Read more >Scheduled Calls Documentation - Setup & Data Integration
The LibPhoneNumber library exposes a subset of the google-libphonenumber library ... PhoneNumberType, PhoneNumberFormat, PhoneNumberUtil } = LibPhoneNumber; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmm, I guess we could export that. Something like:
Would that work?
Hello, I believe this issue could be solved using const assertion in typescript 3.4+.
NumberType basically stays the same but is now derived from a readonly tuple. numberTypes can be exported and iterated over as proposed in https://github.com/catamphetamine/libphonenumber-js/issues/392#issuecomment-696700234.
Cheers