packages/babel-plugin-transform-simplify-comparison-operators/src/index.js
function baseTypeStrictlyMatches(left, right) {
    let leftTypes, rightTypes;

    if (t.isIdentifier(left)) {
      leftTypes = customTypeAnnotation(left);
    } else if (t.isIdentifier(right)) {
      rightTypes = customTypeAnnotation(right);
    }

    // Early exit
    if (t.isAnyTypeAnnotation(leftTypes) || t.isAnyTypeAnnotation(rightTypes)) {
      return false;
    }

    leftTypes = [].concat(leftTypes, left.getTypeAnnotation());
    rightTypes = [].concat(rightTypes, right.getTypeAnnotation());

    leftTypes = t.createUnionTypeAnnotation(leftTypes);
    rightTypes = t.createUnionTypeAnnotation(rightTypes);

    if (
      !t.isAnyTypeAnnotation(leftTypes) &&
      t.isFlowBaseAnnotation(leftTypes)
    ) {
      return leftTypes.type === rightTypes.type;
    }
  }
function baseTypeStrictlyMatches(left, right) {
    let leftTypes, rightTypes;

    if (t.isIdentifier(left)) {
      leftTypes = customTypeAnnotation(left);
    } else if (t.isIdentifier(right)) {
      rightTypes = customTypeAnnotation(right);
    }

    // Early exit
    if (t.isAnyTypeAnnotation(leftTypes) || t.isAnyTypeAnnotation(rightTypes)) {
      return false;
    }

    leftTypes = [].concat(leftTypes, left.getTypeAnnotation());
    rightTypes = [].concat(rightTypes, right.getTypeAnnotation());

    leftTypes = t.createUnionTypeAnnotation(leftTypes);
    rightTypes = t.createUnionTypeAnnotation(rightTypes);

    if (
      !t.isAnyTypeAnnotation(leftTypes) &&
      t.isFlowBaseAnnotation(leftTypes)
    ) {
      return leftTypes.type === rightTypes.type;
    }
  }
function baseTypeStrictlyMatches ( left , right ) { let leftTypes , rightTypes ; if ( t . isIdentifier ( left ) ) { leftTypes = customTypeAnnotation ( left ) ; } else if ( t . isIdentifier ( right ) ) { rightTypes = customTypeAnnotation ( right ) ; } // Early exit if ( t . isAnyTypeAnnotation ( leftTypes ) || t . isAnyTypeAnnotation ( rightTypes ) ) { return false ; } leftTypes = [ ] . concat ( leftTypes , left . getTypeAnnotation ( ) ) ; rightTypes = [ ] . concat ( rightTypes , right . getTypeAnnotation ( ) ) ; leftTypes = t . createUnionTypeAnnotation ( leftTypes ) ; rightTypes = t . createUnionTypeAnnotation ( rightTypes ) ; if ( ! t . isAnyTypeAnnotation ( leftTypes ) && t . isFlowBaseAnnotation ( leftTypes ) ) { return leftTypes . type === rightTypes . type ; } }
Based on the type inference in Babel
Based on the type inference in Babel