We can't use type assertions on generic typed variables. This seems like really strange behavior considering it's allowed by interface{}, but not by a generic constrained by interface{}. Wondering if there are any work arounds?
// This works
func isInt(x interface{}) bool {
_, ok := x.(int)
return ok;
}
// Compile Error
// invalid operation: cannot use type assertion on type parameter
// value x (variable of type T constrained by interface{})
func isInt2[T interface{}](x T) bool {
_, ok := x.(int)
return ok;
}