TypeScript/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.types
Anders Hejlsberg 8058619aed
Control flow analysis of aliased conditional expressions and discriminants (#44730)
* CFA inlining of conditional expressions referenced by const variables

* Accept new baselines

* Add tests

* Accept new baselines

* Increase inlining limit to 5 levels per design meeting discussion
2021-06-25 13:59:58 -07:00

33 lines
1 KiB
Plaintext

=== tests/cases/compiler/controlFlowCommaExpressionAssertionWithinTernary.ts ===
declare function assert(value: any): asserts value;
>assert : (value: any) => asserts value
>value : any
function foo2(param: number | null | undefined): number | null {
>foo2 : (param: number | null | undefined) => number | null
>param : number | null | undefined
>null : null
>null : null
const val = param !== undefined;
>val : boolean
>param !== undefined : boolean
>param : number | null | undefined
>undefined : undefined
return val ? (assert(param !== undefined), param) : null;
>val ? (assert(param !== undefined), param) : null : number | null
>val : boolean
>(assert(param !== undefined), param) : number | null
>assert(param !== undefined), param : number | null
>assert(param !== undefined) : void
>assert : (value: any) => asserts value
>param !== undefined : boolean
>param : number | null
>undefined : undefined
>param : number | null
>null : null
// ^^^^^ Still typed as number | null | undefined
}