Closed sman591 closed 4 years ago
Is there a reason it isn't typed like this to begin with?
Me not using TypeScript.
I'll add the | {}
, thx.
Cool! I wasn't sure if there was any historical reason behind it. Thanks for the quick response!
By the way, parseNumber()
has been deprecated for a while, and the new API is parsePhoneNumberFromString()
.
Should be fixed in the latest version.
Thank you!
I noticed the following in the README for
parseNumber()
:The invalid state here, where "an empty object {} is returned", isn't captured by the current TypeScript definition:
https://github.com/catamphetamine/libphonenumber-js/blob/7cf75a796a5cc11f4510ddb407fa8d025073cae1/custom.d.ts#L54
I'd like to propose changing this type to match the full return type of this function; something like:
Is there a reason it isn't typed like this to begin with?