* Returns the type of an expression. Unlike checkExpression, this function is simply concerned * with computing the type and may not fully check all contained sub-expressions for errors. * It is intended for uses where you know there is no contextual type, * and requesting
(node)
| 79835 | * It sets the contextual type of the node to any before calling getTypeOfExpression. |
| 79836 | */ |
| 79837 | function getContextFreeTypeOfExpression(node) { |
| 79838 | var links = getNodeLinks(node); |
| 79839 | if (links.contextFreeType) { |
| 79840 | return links.contextFreeType; |
| 79841 | } |
| 79842 | var saveContextualType = node.contextualType; |
| 79843 | node.contextualType = anyType; |
| 79844 | try { |
| 79845 | var type = links.contextFreeType = checkExpression(node, 4 /* CheckMode.SkipContextSensitive */); |
| 79846 | return type; |
| 79847 | } |
| 79848 | finally { |
| 79849 | // In the event our operation is canceled or some other exception occurs, reset the contextual type |
| 79850 | // so that we do not accidentally hold onto an instance of the checker, as a Type created in the services layer |
| 79851 | // may hold onto the checker that created it. |
| 79852 | node.contextualType = saveContextualType; |
| 79853 | } |
| 79854 | } |
| 79855 | function checkExpression(node, checkMode, forceTuple) { |
| 79856 | ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* tracing.Phase.Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); |
| 79857 | var saveCurrentNode = currentNode; |
no test coverage detected
searching dependent graphs…