Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect types for PhoneNumberCapabilities #833

Open
stephenwade opened this issue Dec 2, 2022 · 3 comments
Open

Incorrect types for PhoneNumberCapabilities #833

stephenwade opened this issue Dec 2, 2022 · 3 comments
Labels
status: waiting for feature feature will be implemented in the future type: bug bug in the library

Comments

@stephenwade
Copy link
Contributor

Issue Summary

The TypeScript types for phone number capabilities are wrong. The types are all lowercase, but the actual API response has some uppercase keys. Also, the types say fax will be present, but it is absent.

Steps to Reproduce

image

Code Snippet

import { Twilio } from "twilio";

const keySid = "REDACTED";
const keySecret = "REDACTED";
const accountSid = "REDACTED";

const client = new Twilio(keySid, keySecret, { accountSid });

const [phoneNumber] = await client.availablePhoneNumbers("US").local.list();

console.log(Object.keys(phoneNumber.capabilities));
// [ 'voice', 'SMS', 'MMS' ]

Technical details:

  • twilio-node version: 3.83.3
  • node version: 16.8.1
@Hunga1
Copy link
Contributor

Hunga1 commented Dec 6, 2022

Hello @stephenwade. Thanks for pointing this out. I was able to reproduce the issue where the payload from the API and the phoneNumber.capabilities properties differ from the TS type. The SMS and MMS property names were all uppercase rather than lowercase. I'll check what the correct property names are for these should be.

Although, my API response and phoneNumber.capabilities object contained the fax property as well. I wasn't able to reproduce the missing fax property on my end.

@Hunga1 Hunga1 added the type: bug bug in the library label Dec 6, 2022
@stephenwade
Copy link
Contributor Author

Thanks for the reply @Hunga1! I guess you can ask the dev team what properties are optional and make those optional properties in the types. I can definitely reproduce the missing fax property every time so I think it should be optional (fax?: boolean).

@Hunga1
Copy link
Contributor

Hunga1 commented Dec 6, 2022

This issue has been added to our internal backlog to be prioritized (internal ref: DI-2467).

@Hunga1 Hunga1 added the status: waiting for feature feature will be implemented in the future label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for feature feature will be implemented in the future type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants