General interfaces
…
Implementation restriction: A union (with more than one term) cannot contain the predeclared identifier
comparableor interfaces that specify methods, or embedcomparableor interfaces that specify methods.
Or putting this another way: Unions (that is, interface type parameters with a | character), only work on interfaces defined by other type parameters.
interface {
int | float32 // Valid
int | error // Invalid: error is an interface that specifies a method
int | comparable // Invalid: comparable is not a type parameter-defined interface
}
Quotes from _The Go Programming Language Specification_ Version of December 15, 2022