How to implement a generic restriction in Swift?

Imagine we have a generic enum I like this:

enum GenericEnum {
    case typed(T)
    case untyped(Error)
}

For the sake of easier access for some UI jobs, we have to implement an extension for this:

extension GenericEnum {

    var validValue: T? {
        if case .typed(let value) = self {
            return value
        } else {
            return nil
        }
    }
}

validValue returns the real value or nil. And we can use it as:

let genericEnums = (GenericEnum.typed(1), GenericEnum.typed(2), GenericEnum.typed(3))
let result = genericEnums.compactMap { $0.validValue }

So far so good.

The question

Now, to get an easier code to call, I want to move the usage method to an extension in the Array I like it:

extension Array where Element == GenericEnum { // `Int` should be generic here
    var customCompacted: (Int) { // `Int` should be generic here
        compactMap { $0.validValue }
    }
}

But i need Int be generic, but all attempts generate an error such as:

The reference to the generic type & # 39; GenericEnum & # 39; requires arguments in <...>

And etc. How can I make this generic?