function getOrder(data:{
id:number,
withItems?: boolean,
}): Order | (Order&Order_Items) {
/* here i would call the external API with data as the POST data, but return two different types, if withItems was in the data or not */
}
const theOrder1 = getOrder({id: 1,})
const theOrder2 = getOrder({id: 1, withItems:true});
function getOrder(data:{
id:number,
withItems?: boolean,
}): Order | (Order&Order_Items) {
/* here i would call the external API with data as the POST data, but return two different types, if withItems was in the data or not */
}
const theOrder1 = getOrder({id: 1,})
const theOrder2 = getOrder({id: 1, withItems:true});