3 ms·
That would be similar to an intersection type (https://www.typescriptlang.org/docs/handbook/advanced-types.html https://www.typescriptlang.org/docs/handbook/adv
by realharo 10y ago
That would be similar to an intersection type (https://www.typescriptlang.org/docs/handbook/advanced-types.html https://www.typescriptlang.org/docs/handbook/advanced-types....), but due to the way Go works, it cannot contain duplicates, and it doesn't work for structs. Union type is "it can be one of these types", and you can then access only fields/methods that all of those types share (unless you cast them of course). The naming can be a bit counter-intuitive.