Skip to content

Conversation

@victorlunam
Copy link

Fixes #1148

Description

This PR fixes a bug where line_type_intelligence fields returned from the Lookups API (in snake_case) were not mapped to the camelCase properties expected by the PhoneNumberInstance class.

Breaking Change:
This change creates a new object for lineTypeIntelligence rather than assigning the raw payload.

  • Previously: The object contained snake_case keys (e.g., mobile_country_code) at runtime, while the TypeScript definitions existed for camelCase (e.g., mobileCountryCode) but returned undefined.
  • Now: The object correctly contains camelCase keys. Any integrations relying on the undocumented/untyped snake_case keys at runtime will break and must be updated to use the camelCase equivalents.

What was changed

  • Updated the PhoneNumberInstance constructor to manually map line_type_intelligence properties:
    • mobile_country_codemobileCountryCode
    • mobile_network_codemobileNetworkCode
    • carrier_namecarrierName
    • typetype
    • error_codeerrorCode
  • Ensured strict camelCase adherence to match the LineTypeIntelligenceInfo interface.

Why the change was necessary

The PhoneNumberInstance was assigning the raw API response directly to the class property, causing a mismatch between the TypeScript definitions (camelCase) and the runtime values (snake_case). This resulted in undefined values when using the typed properties.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: LineTypeIntelligence properties undefined due to missing snake_case to camelCase mapping

1 participant