Here is my ts code
var el:number|null
export const im=function(){
if (el==null){
const ans= {
exists:false
}
return ans
}
const ans2={
value:7,
exists:true,
}
return ans2
}()
By looking at the code, the type of im should be:
const im2: {
value: number;
exists: boolean;
} | {
exists: boolean;
}
But in reality it is not. the generated .d.ts reads:
export declare const im2: {
exists: boolean;
};
my question is: why is it?