When working with two API calls that return different responses, one typed as TestData1Res and the other as TestData2Res, how can I handle the scenario where the response could be either type and process the property?
`TestData1Res{ testData: string }
TestData2Res{ data: string }
this.getData1().pipe(catchError(error => this.getData2()))
.subscribe(
(res: TestData1Res|TestData2Res) => {
if (res.testData) { //error 'Property 'testData' does not exist on type 'TestData1Res | TestData2Res'
}
if (res.data) { //error 'Property 'data' does not exist on type 'TestData1Res | TestData2Res'
}
}
);`