-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
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.
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code