TypeScript/tests/baselines/reference/nonContextuallyTypedLogicalOr.js

23 lines
435 B
JavaScript
Raw Normal View History

2014-07-13 01:04:16 +02:00
//// [nonContextuallyTypedLogicalOr.ts]
interface Contextual {
dummy;
p?: number;
}
interface Ellement {
dummy;
p: any;
}
var c: Contextual;
var e: Ellement;
// This should error. Even though we are contextually typing e with Contextual, the RHS still
// needs to be a supertype of the LHS to win as the best common type.
(c || e).dummy;
//// [nonContextuallyTypedLogicalOr.js]
var c;
var e;
(c || e).dummy;