TypeScript/tests/cases/conformance/controlFlow
Anders Hejlsberg 15fae38b39
Improve narrowing of generic types in control flow analysis (#43183)
* Narrow type variables with union constraints when merited by contextual type

* Narrow generics with union type constraints as indicated by contextual type

* Accept new baselines

* Add tests

* Fix circularity for JSX elements

* Remove unnecessary isConstraintPosition information from flow cache key

* Update comment

* Add additional tests

* Rename to getNarrowableTypeForReference, remove getConstraintForLocation

* Add comment

* Fix removal of undefined in destructurings with initializers

* Use getContextFreeTypeOfExpression in discriminateContextualTypeByObjectMembers

* In obj[x], use constraint of obj's type only when x's type is non-generic

* Add comment
2021-03-19 17:12:57 -07:00
..
assertionTypePredicates1.ts Minor fix for assertion predicates (#38710) 2020-06-20 18:27:51 -07:00
constLocalsInFunctionExpressions.ts
controlFlowAssignmentExpression.ts Allow assignments to a narrowable reference to be considered narrowable 2020-07-29 16:37:25 -07:00
controlFlowAssignmentPatternOrder.ts Update control flow for nested binary exprs 2020-10-29 13:32:32 -07:00
controlFlowBinaryAndExpression.ts
controlFlowBinaryOrExpression.ts
controlFlowBindingPatternOrder.ts Update control flow for correct destructuring evaluation order 2020-10-28 16:50:15 -07:00
controlFlowCommaOperator.ts
controlFlowConditionalExpression.ts
controlFlowDeleteOperator.ts
controlFlowDestructuringDeclaration.ts
controlFlowDoWhileStatement.ts
controlFlowElementAccess.ts Elt access assignment uses declared, not narrowed type (#27574) 2018-10-05 11:30:10 -07:00
controlFlowElementAccess2.ts Control flow for element access expressions (#31478) 2019-07-16 10:10:58 -07:00
controlFlowForInStatement.ts
controlFlowForOfStatement.ts
controlFlowForStatement.ts
controlFlowGenericTypes.ts Improve narrowing of generic types in control flow analysis (#43183) 2021-03-19 17:12:57 -07:00
controlFlowIfStatement.ts Narrow QualifiedName inside typeof (#42540) 2021-01-28 15:19:01 -08:00
controlFlowIIFE.ts
controlFlowInstanceofExtendsFunction.ts Replace subtype check in derivedness check with flags and structure checks (#27403) 2018-10-04 12:55:39 -07:00
controlFlowInstanceOfGuardPrimitives.ts Primitives should not be instanceof... anything (#27402) 2018-09-27 15:49:51 -07:00
controlFlowIteration.ts
controlFlowIterationErrors.ts
controlFlowNullishCoalesce.ts nullish coalescing commit (#32883) 2019-09-30 15:33:50 -07:00
controlFlowOptionalChain.ts Fix erroneous optional chain narrowing (#36145) 2020-01-16 16:49:51 -08:00
controlFlowOptionalChain2.ts Fix discriminant property narrowing through optional chain with null (#42503) 2021-01-29 12:03:42 -08:00
controlFlowStringIndex.ts
controlFlowSuperPropertyAccess.ts
controlFlowTruthiness.ts
controlFlowWhileStatement.ts
controlFlowWithTemplateLiterals.ts
definiteAssignmentAssertions.ts fix(41965): fix error in definite assignment assertion context (#41989) 2020-12-30 11:45:18 -08:00
definiteAssignmentAssertionsWithObjectShortHand.ts
exhaustiveSwitchStatements1.ts Fixed issue where non null assertion caused getFlowTypeOfReference to return the declared type if the type was already narrowed to never. (#35863) 2021-03-11 07:33:33 -08:00
neverReturningFunctions1.ts Support properties of mapped types in assertion control flow analysis (#40482) 2020-09-21 07:07:29 -10:00
switchWithConstrainedTypeVariable.ts
typeGuardsAsAssertions.ts
typeGuardsNestedAssignments.ts
typeGuardsTypeParameters.ts