code: private JSType restrictByUndefined(JSType type) {
      // If not voidable, there's nothing to do. If not nullable then the easiest
      // thing is to simply remove both null and undefined. If nullable, then add
      // null back into the union after removing null and undefined.
      if (!type.isVoidable()) {
        return type;
      }
      JSType restricted = type.restrictByNotNullOrUndefined();
      if (type.isNullable()) {
        JSType nullType = registry.getNativeType(JSTypeNative.NULL_TYPE);
        return registry.createUnionType(ImmutableList.of(restricted, nullType));
      }
      // The bottom type cannot appear in a jsdoc
      return restricted.isEmptyType() ? type : restricted;
    }
docs: Removes undefined from a union type.