code: function checkExpression(node, contextualMapper) {
              var type;
              if (node.kind === 139 /* QualifiedName */) {
                  type = checkQualifiedName(node);
              }
              else {
                  var uninstantiatedType = checkExpressionWorker(node, contextualMapper);
                  type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);
              }
              if (isConstEnumObjectType(type)) {
                  // enum object type for const enums are only permitted in:
                  // - 'left' in property access
                  // - 'object' in indexed access
                  // - target in rhs of import statement
                  var ok = (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.expression === node) ||
                      (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.expression === node) ||
                      ((node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node));
                  if (!ok) {
                      error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment);
                  }
              }
              return type;
          }
docs: Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in conjunction with the generic contextual type. When contextualMapper is equal to the identityMapper function object, it serves as an indicator that all contained function and arrow expressions should be considered to have the wildcard function type; this form of type check is used during overload resolution to exclude contextually typed function and arrow expressions in the initial phase.