public static function compareTypes(TypeInterface $typeA, TypeInterface $typeB): bool
    {
        if ($typeA instanceof ListType) {
            return $typeB instanceof ListType
                ? self::compareTypes($typeA->getOfType(), $typeB->getOfType())
                : true;
        }
        if ($typeB instanceof ListType) {
            return true;
        }
        if ($typeA instanceof NonNullType) {
            return $typeB instanceof NonNullType
                ? self::compareTypes($typeA->getOfType(), $typeB->getOfType())
                : true;
        }
        if ($typeB instanceof NonNullType) {
            return true;
        }
        if ($typeA instanceof LeafTypeInterface || $typeB instanceof LeafTypeInterface) {
            return $typeA !== $typeB;
        }
        return false;
    }