TypeScript/tests/baselines/reference/logicalOrExpressionIsNotContextuallyTyped.js
2014-07-12 17:30:19 -07:00

16 lines
517 B
JavaScript

//// [logicalOrExpressionIsNotContextuallyTyped.ts]
// The || operator permits the operands to be of any type.
// If the || expression is not contextually typed, the right operand is contextually typed
// by the type of the left operand and the result is of the best common type of the two
// operand types.
var a: (a: string) => string;
// bug 786110
var r = a || ((a) => a.toLowerCase());
//// [logicalOrExpressionIsNotContextuallyTyped.js]
var a;
var r = a || (function (a) { return a.toLowerCase(); });