(node, child)
| 72835 | return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined; |
| 72836 | } |
| 72837 | function getContextualTypeForChildJsxExpression(node, child) { |
| 72838 | var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName); |
| 72839 | // JSX expression is in children of JSX Element, we will look for an "children" attribute (we get the name from JSX.ElementAttributesProperty) |
| 72840 | var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); |
| 72841 | if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) { |
| 72842 | return undefined; |
| 72843 | } |
| 72844 | var realChildren = ts.getSemanticJsxChildren(node.children); |
| 72845 | var childIndex = realChildren.indexOf(child); |
| 72846 | var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName); |
| 72847 | return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) { |
| 72848 | if (isArrayLikeType(t)) { |
| 72849 | return getIndexedAccessType(t, getNumberLiteralType(childIndex)); |
| 72850 | } |
| 72851 | else { |
| 72852 | return t; |
| 72853 | } |
| 72854 | }, /*noReductions*/ true)); |
| 72855 | } |
| 72856 | function getContextualTypeForJsxExpression(node) { |
| 72857 | var exprParent = node.parent; |
| 72858 | return ts.isJsxAttributeLike(exprParent) |
no test coverage detected
searching dependent graphs…