2014-07-13 01:04:16 +02:00
|
|
|
//// [logicalOrExpressionIsContextuallyTyped.ts]
|
|
|
|
// The || operator permits the operands to be of any type.
|
|
|
|
// If the || expression is contextually typed, the operands are contextually typed by the
|
|
|
|
// same type and the result is of the best common type of the contextual type and the two
|
|
|
|
// operand types.
|
|
|
|
|
|
|
|
var r: { a: string } = { a: '', b: 123 } || { a: '', b: true };
|
|
|
|
|
|
|
|
//// [logicalOrExpressionIsContextuallyTyped.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// The || operator permits the operands to be of any type.
|
|
|
|
// If the || expression is contextually typed, the operands are contextually typed by the
|
|
|
|
// same type and the result is of the best common type of the contextual type and the two
|
|
|
|
// operand types.
|
2015-03-09 02:23:23 +01:00
|
|
|
var r = {
|
|
|
|
a: '',
|
|
|
|
b: 123
|
|
|
|
} || {
|
|
|
|
a: '',
|
|
|
|
b: true
|
|
|
|
};
|