Skip to content

isTwimlResponse

function isTwimlResponse(value): value is TwimlResponse;

Defined in: lib/twiml/twiml.interceptor.ts:156

Type guard identifying Twilio TwiML builder instances: VoiceResponse, MessagingResponse or FaxResponse.

Checked against the three concrete builders exported from the twilio package root rather than their shared base class, which is reachable only through a deep import that breaks under ESM.

Parameter Type Description
value unknown The controller return value to inspect.

value is TwimlResponse

if (isTwimlResponse(value)) {
response.header('Content-Type', 'text/xml');
return value.toString();
}