Well I guess I should have posted sooner, because as usually happens once I post I find the answer.

I only stumbled upon this while using JSFiddle. I noticed that they had dependencies you can add, among them was the JavaScript port of libphonenumber (which I'd already tried to use). While it doesn't load correctly in JSFiddle because the connection is refused, the link still works to a minified version.

See here: Minified JavaScript of libphonenumber-js

Once I dropped this in place, and modified my code a bit, suddenly we're off to the races and everything is golden.

<script type="text/javascript" language="javascript" src="/static/js/libphonenumber-js.min.js"></script>
<script type="text/javascript">
     $(".phone-format").keyup(function () {
            var val_old = $(this).val();
            var newString = new libphonenumber.AsYouType('US').input(val_old);
            $(this).focus().val('').val(newString);
    });
</script>

I'm really still curious if I just missed something in all the searching I've done over the last couple days, because I don't feel it should have been this difficult or require this much reverse engineering to be able to find this version of the package.

Oh well, hope this helps someone!

Answer from Chockomonkey on Stack Overflow
🌐
Catamphetamine
catamphetamine.github.io › libphonenumber-js
libphonenumber-js
A simpler and smaller rewrite of Google Android's libphonenumber library.
🌐
GitHub
github.com › catamphetamine › libphonenumber-js › blob › master › types.d.ts
libphonenumber-js/types.d.ts at master · catamphetamine/libphonenumber-js
export type NumberType = undefined | 'PREMIUM_RATE' | 'TOLL_FREE' | 'SHARED_COST' | 'VOIP' | 'PERSONAL_NUMBER' | 'PAGER' | 'UAN' | 'VOICEMAIL' | 'FIXED_LINE_OR_MOBILE' | 'FIXED_LINE' | 'MOBILE';
Author   catamphetamine
🌐
npm
npmjs.com › package › libphonenumber-js
libphonenumber-js - npm
2 weeks ago - With many websites today asking ... numbers, and that's what libphonenumber-js is. Smaller footprint: 145 kB (65 kB code + 80 kB sufficient metadata) vs the original Google's 550 kB (350 kB code + 200 kB full metadata). Comes with TypeScript definitions....
      » npm install libphonenumber-js
    
Published   Mar 28, 2026
Version   1.12.41
Author   catamphetamine
🌐
npm
npmjs.com › package › @types › google-libphonenumber
types/google-libphonenumber
This package contains type definitions for google-libphonenumber (https://github.com/googlei18n/libphonenumber).
      » npm install @types/google-libphonenumber
    
🌐
GitHub
github.com › catamphetamine › libphonenumber-js
GitHub - catamphetamine/libphonenumber-js: A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript · GitHub
With many websites today asking ... numbers, and that's what libphonenumber-js is. Smaller footprint: 145 kB (65 kB code + 80 kB sufficient metadata) vs the original Google's 550 kB (350 kB code + 200 kB full metadata). Comes with TypeScript definitions....
Starred by 3K users
Forked by 211 users
Languages   JavaScript 98.2% | HTML 1.7%
🌐
GitHub
github.com › google › libphonenumber
GitHub - google/libphonenumber: Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers. · GitHub
Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers. - google/libphonenumber
Starred by 17.9K users
Forked by 2.2K users
Languages   C++ 53.4% | Java 29.9% | JavaScript 15.8% | CMake 0.4% | C 0.2% | Closure Templates 0.1%
🌐
cdnjs
cdnjs.com › home › libraries › libphonenumber-js
libphonenumber-js - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
https://halt-hammerzeit.github.io/libphonenumber-js/ Tags: javascript, telephone, phone, number, input, mobile, android, iphone, international, libphonenumber · Version · 1.12.23 · Loading... Asset Type · All · Loading... https://cdnjs.cloudflare.com/ajax/libs/libphonenumber-js/1.12.23/libphonenumber-js.min.js ·
Top answer
1 of 4
18

When dealing with CommonJS libraries, in TypeScript just like this google-libphonenumber, I'd like to suggest 2 ways about it (Tested by me and works well).

Initially, I'd like to suggest to install from NPM just like this: npm install --save google-libphonenumber.

Then, here we go both ways of using it:

1st Method

Just import it directly

import libphonenumber from 'google-libphonenumber';
class Something {
    constructor() {//Just example, you can chose any method
        const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance();
        console.log( phoneUtil.getSupportedRegions() );//It should works and give you some output
    }
}

2nd Method

You still can make the power of Typescript typing or just use the existing one by: npm install --save-dev @types/google-libphonenumber.

Since you said that you using Angular, so you can declare that typing just installed at src/tsconfig.app.json ( I am using Angular Version 7 ). Here is an example I have made:

{
  ...
  "compilerOptions": {
    ...
    "types": [
      "google-libphonenumber"
    ]
  },
  ...
}

Then you can just import it like usual, in Typescript "typings" way like follow:

import { PhoneNumberUtil } from 'google-libphonenumber';

class Something {
    constructor() {//Just example, you can chose any method
        const phoneUtil: PhoneNumberUtil = PhoneNumberUtil.getInstance();
        console.log( phoneUtil.getSupportedRegions() );//It should works and give you some output
    }
}
2 of 4
3

you may either go with libphonenumber or google-libphonenumber as both of this library having a good number of installs also google-libphonenumber seems to be more powerful

Find elsewhere
🌐
Js
libphonenumbers.js.org
libphonenumbers: Introduction
If you are not redirected automatically, follow this link
🌐
Phrase
phrase.com › home › resources › blog › using libphonenumber for international phone numbers
Using libphonenumber for International Phone Numbers | Phrase
January 3, 2025 - mobile — the complete metadata set for dealing with mobile numbers only, about 95 kilobytes in size (libphonenumber-js/metadata.mobile.json); make use of it when you need max metadata and when you only accept mobile numbers; other phone number types will still be parseable, but they won’t be recognized as being “valid” (.isValid() will return false).
🌐
UNPKG
unpkg.com › browse › @botique › libphonenumber-js@1.0.27 › README.md
botique/libphonenumber-js/README.md
This solution is sufficient for all use cases except for phone number extensions which Google's "As You Type" formatter does not support. If your project requires phone number extensions input then use a separate input field for that. ### getCountryCallingCode(country) There have been requests for a function returning a country calling code by [country code](https://github.com/catamphetamine/libphonenumber-js#country-code-definition).
🌐
Js
libphonenumbers.js.org › docs › getNumberType
getNumberType | libphonenumbers
getNumberType(number) is used to gets the type of a valid phone number · Using Standard JavaScript:
🌐
GitHub
github.com › catamphetamine › libphonenumber-js › blob › master › CHANGELOG.md
libphonenumber-js/CHANGELOG.md at master · catamphetamine/libphonenumber-js
The applications that're using it should do npm install libphonenumber-metadata-generator --save-dev and then use the new libphonenumber-metadata-generator command instead of the old one (only the name changed). See instructions. Refactored AsYouType formatter. Fixed AsYouType formatter not formatting numbers in some cases like, for example, certain types of Argentinian mobile numbers.
Author   catamphetamine
🌐
npm
npmjs.com › package › google-libphonenumber
google-libphonenumber - npm
January 19, 2026 - It is used by Android since version 4.0 and is a phenomenal repository of carrier metadata. Although it compiles down to Java, C++ and JS, its JS port is tightly coupled to the Google Closure library.
      » npm install google-libphonenumber
    
Published   Jan 19, 2026
Version   3.2.44
Author   Rui Marinho
🌐
Appspot
libphonenumber.appspot.com
Phone Number Parser Demo for LibPhoneNumber
Specify a Phone Number: · Or Upload a file containing phone numbers separated by comma
🌐
GitHub
github.com › catamphetamine › libphonenumber-js › blob › master › index.d.ts
libphonenumber-js/index.d.ts at master · catamphetamine/libphonenumber-js
} from './types.d.js'; · export { MetadataJson, Examples, E164Number, CountryCallingCode, CountryCode, CarrierCode, NationalNumber, Extension, ParseError, // `FormatNumberOptions` export is deprecated. // It's still here just due to legacy compatibility. // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/174#note_2380633424 ·
Author   catamphetamine
🌐
CodeSandbox
codesandbox.io › examples › package › libphonenumber-js
libphonenumber-js examples - CodeSandbox
Use this online libphonenumber-js playground to view and fork libphonenumber-js example apps and templates on CodeSandbox.
🌐
UNPKG
unpkg.com › browse › libphonenumber-js@0.4.38 › README.md
libphonenumber-js
* `--types ...` argument may be passed instead of `--extended` to only include the precise phone number type regular expressions for a specific set of phone number types (a comma-separated list, e.g. `--types mobile,fixed`). Then use the generated `metadata.min.json` with the exported "custom" functions. For a "tree-shaking" ES6-capable bundler (e.g. Webpack 2) that would be ```js import { parseCustom, formatCustom, isValidNumberCustom, asYouTypeCustom } from 'libphonenumber-js' import metadata from './metadata.min.json' export const parse = (...args) => parseCustom(...args, metadata) export c
🌐
UNPKG
app.unpkg.com › libphonenumber-js@1.2.22 › files › README.md
libphonenumber-js
This is just an alias for `new AsYouType(country, metadata).input(value)`. Can be used for building a phone number input component (e.g. [react-phone-number-input](https://github.com/catamphetamine/react-phone-number-input/)). ```js formatIncompletePhoneNumber('8800555', 'RU', metadata) === '8 (800) 555' formatIncompletePhoneNumber('+7800555', null, metadata) === '+7 800 555' ``` ## React There's also a React component utilizing this library — [`react-phone-number-input`](https://github.com/catamphetamine/react-phone-number-input) (or [without country select](https://github.com/catamphetamin