(node, contextFlags)
| 72908 | // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily |
| 72909 | // be "pushed" onto a node using the contextualType property. |
| 72910 | function getApparentTypeOfContextualType(node, contextFlags) { |
| 72911 | var contextualType = ts.isObjectLiteralMethod(node) ? |
| 72912 | getContextualTypeForObjectLiteralMethod(node, contextFlags) : |
| 72913 | getContextualType(node, contextFlags); |
| 72914 | var instantiatedType = instantiateContextualType(contextualType, node, contextFlags); |
| 72915 | if (instantiatedType && !(contextFlags && contextFlags & 2 /* ContextFlags.NoConstraints */ && instantiatedType.flags & 8650752 /* TypeFlags.TypeVariable */)) { |
| 72916 | var apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true); |
| 72917 | return apparentType.flags & 1048576 /* TypeFlags.Union */ && ts.isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : |
| 72918 | apparentType.flags & 1048576 /* TypeFlags.Union */ && ts.isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : |
| 72919 | apparentType; |
| 72920 | } |
| 72921 | } |
| 72922 | // If the given contextual type contains instantiable types and if a mapper representing |
| 72923 | // return type inferences is available, instantiate those types using that mapper. |
| 72924 | function instantiateContextualType(contextualType, node, contextFlags) { |
no test coverage detected
searching dependent graphs…