twilio-node
twilio-node copied to clipboard
Broken typescript definitions for twiml
The type definitions that ship for TwiML classes should say what types the methods return, rather than specifying any, which is useless for type checking.
In the following example:
const message = new twilio.twiml.MessagingResponse();
const markup = message.toString();
the type of markup is any, rather than string, which makes the value useless for type checking.
Typescript projects using typescript-eslint will struggle to use this value:
const myTwiml = new twilio.twiml.MessagingResponse();
const markup = myTwiml.toString();
return new Response(markup, { headers: { 'Content-Type': 'text/xml' } });
eslint will raise:
error Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment
error Unsafe argument of type `any` assigned to a parameter of type `BodyInit | null | undefined` @typescript-eslint/no-unsafe-argument
Thanks for raising the issue. We will check this