2014-12-10 19:17:48 +01:00
|
|
|
//// [typeGuardsWithAny.ts]
|
|
|
|
var x: any = { p: 0 };
|
|
|
|
if (x instanceof Object) {
|
2014-12-10 23:25:02 +01:00
|
|
|
x.p; // No error, type any unaffected by type guard
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
x.p; // No error, type any unaffected by type guard
|
2014-12-10 19:17:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//// [typeGuardsWithAny.js]
|
|
|
|
var x = { p: 0 };
|
|
|
|
if (x instanceof Object) {
|
2014-12-10 23:25:02 +01:00
|
|
|
x.p; // No error, type any unaffected by type guard
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
x.p; // No error, type any unaffected by type guard
|
2014-12-10 19:17:48 +01:00
|
|
|
}
|