Closed
Description
Hi all!
interface A {
prop: string
}
function isA(arg: any): arg is A {
return "prop" in arg;
}
function handle(arg: any) {
if (isA(arg)) {
let b = arg.nonExistsProp; // no compile error here
}
}
Why there is no compile error while acessing nonExistsProp
? Is it by design and guard function only works with union types? Can't find some sort of specs, please, help me.