joey
07/07/2025, 5:58 AMvapi.calls.create it returns the following type:
export type CallsCreateResponse = Vapi.Call | Vapi.CallBatchResponse;
Since there are no shared props, Typescript can't narrow it automatically. So I have to do something like:
const isCall = (response: CallsCreateResponse): response is Vapi.Call => {
return 'id' in response;
};
I’d rather avoid writing this manually. Am I missing a better way to handle this?Chiranjeet Mishra
07/07/2025, 6:55 AMconst isCall = (res: CallsCreateResponse): res is Vapi.Call => 'id' in res; is concise and effective, especially given the lack of shared properties..joey
07/07/2025, 8:44 PMKings_big💫
07/08/2025, 7:15 AM