code: function getTypeAnnotationBindingConstantViolations(path, name) {
    var binding = path.scope.getBinding(name);
  
    var types = [];
    path.typeAnnotation = t.unionTypeAnnotation(types);
  
    var functionConstantViolations = [];
    var constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations);
  
    var testType = getConditionalAnnotation(path, name);
    if (testType) {
      var testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
  
      // remove constant violations observed before the IfStatement
      constantViolations = constantViolations.filter(function (path) {
        return testConstantViolations.indexOf(path) < 0;
      });
  
      // clear current types and add in observed test type
      types.push(testType.typeAnnotation);
    }
  
    if (constantViolations.length) {
      // pick one constant from each scope which will represent the last possible
      // control flow path that it could've taken/been
      var rawConstantViolations = constantViolations.reverse();
      var visitedScopes = [];
      constantViolations = [];
      var _arr = rawConstantViolations;
      for (var _i = 0; _i < _arr.length; _i++) {
        var violation = _arr[_i];
        var violationScope = violation.scope;
        if (visitedScopes.indexOf(violationScope) >= 0) continue;
  
        visitedScopes.push(violationScope);
        constantViolations.push(violation);
  
        if (violationScope === path.scope) {
          constantViolations = [violation];
          break;
        }
      }
  
      // add back on function constant violations since we can't track calls
      constantViolations = constantViolations.concat(functionConstantViolations);
  
      // push on inferred types of violated paths
      var _arr2 = constantViolations;
      for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
        var violation = _arr2[_i2];
        types.push(violation.getTypeAnnotation());
      }
    }
  
    if (types.length) {
      return t.createUnionTypeAnnotation(types);
    }
  }
docs: [Please add a description.]