How to use libphonenumber-js node package to format dynamically phone numbers

Hi, I want to replicate the ‘‘As you type’’ effect here:

It is suggested as a basic try that one can run:
import { AsYouType } from ‘libphonenumber-js’
new AsYouType (). input (‘+12133734’) // Outputs: ‘+1 213 373 4’

but it’s not working for me. I received this message TypeError: index_es6_namespaceObject.default is not a constructor in the console. Can somebody help replicate the AsYouType effect using this package? (I know about other solutions to do it but they are not as polished as the example). Thank you!