If only. Sadly generics in Go are nowhere near that advanced and have no possibility of providing even the protections that TypeScript can.