Type Approximation

A type approximation matches not only the type itself, as you would expect, but also any derived type.

Every type T has an underlying type: if T is one of the pre-declared boolean, numeric, or string types, or a literal type, the corresponding underlying type is T itself.

Otherwise, the underlying type of T is the underlying type of the type that T refers to in its type declaration.


type IntegerCustom int
// The underlying type of the above type is int

type People struct{}
// In the case above, the underlying type is the struct
                        
type_approx.go