-
Notifications
You must be signed in to change notification settings - Fork 547
Open
Description
Some of the types exported by this package aren't valid. There's a mix of variable casing and it doesn't seem like results get normalized correctly
For example in this program:
import twilio from "twilio";
async function main() {
const client = twilio(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_AUTH_TOKEN
);
const result = await client.pricing.v2.voice.numbers
.get(process.env.DESTINATION_NUMBER ?? "")
.fetch();
console.log(result);
}
main().catch(console.error);$ pnpm tsx index.ts
{
destinationNumber: '+44xxxxxxx',
originationNumber: null,
country: 'United Kingdom',
isoCountry: 'GB',
outboundCallPrices: [
{
base_price: '0.03050',
current_price: '0.03050',
origination_prefixes: [Array]
}
],
inboundCallPrice: null,
priceUnit: 'USD',
url: 'https://pricing.twilio.com/v2/Voice/Numbers/+44xxxxxxx'
}result is of type NumberInstance and it sets outboundCallPrices but the actual type of that field says a property currentPrice should exist but it's never converted from current_price into currentPrice.
inboundCallPrice can also be null, but that's not reflected in the field type:
| inboundCallPrice: PricingV2VoiceVoiceNumberInboundCallPrice; |
The source type descriptions in the openapi spec correctly mentions that both of these are nullable: https://github.com/twilio/twilio-oai/blob/bcf1d20ba0710f272748c3d23312498e28a99315/spec/yaml/twilio_pricing_v2.yaml#L304-L341
Metadata
Metadata
Assignees
Labels
No labels