2014-12-10 19:17:48 +01:00
|
|
|
=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts ===
|
|
|
|
var x: any = { p: 0 };
|
|
|
|
>x : any
|
|
|
|
>{ p: 0 } : { p: number; }
|
|
|
|
>p : number
|
|
|
|
|
|
|
|
if (x instanceof Object) {
|
|
|
|
>x instanceof Object : boolean
|
|
|
|
>x : any
|
|
|
|
>Object : ObjectConstructor
|
|
|
|
|
2014-12-10 23:25:02 +01:00
|
|
|
x.p; // No error, type any unaffected by type guard
|
|
|
|
>x.p : any
|
|
|
|
>x : any
|
|
|
|
>p : any
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
x.p; // No error, type any unaffected by type guard
|
2014-12-10 19:17:48 +01:00
|
|
|
>x.p : any
|
|
|
|
>x : any
|
|
|
|
>p : any
|
|
|
|
}
|
|
|
|
|