/ SWIFT

Using Typealiases with Generics in Swift

Here is a cool detail about Swift typealiases — you can declare the one with a generic type. Great to make your APIs more expressive:

struct Baz {
    typealias Result<T> = Swift.Result<T, Error>
    
    func foo<T>(_ x: T) -> Result<T> {
        return .success(x)
    }
}