Files
tsgo/testdata/baselines/reference/submodule/compiler/controlFlowCommaExpressionFunctionCall.js

27 lines
762 B
TypeScript

//// [tests/cases/compiler/controlFlowCommaExpressionFunctionCall.ts] ////
//// [controlFlowCommaExpressionFunctionCall.ts]
const otherValue = () => true;
const value : number | string = null as any;
function isNumber(obj: any): obj is number {
return true; // method implementation irrelevant
}
// Bad case - fails
if (isNumber((otherValue(), value))) {
const b = value; // string | number , but should be number
}
//// [controlFlowCommaExpressionFunctionCall.js]
"use strict";
const otherValue = () => true;
const value = null;
function isNumber(obj) {
return true; // method implementation irrelevant
}
// Bad case - fails
if (isNumber((otherValue(), value))) {
const b = value; // string | number , but should be number
}