ℹ️Use of interfaces
Why do generated types implements an interface?
First, because we can't use implicit conversion, we need to have some way to access the underlying value.
Second, to respect the open-close principle, we want developers to be able to add new functionality to their value object without having to modify the sources of the
Typely
generator.Third, the use of interface reduces the redundancy such as for example converters. The same reason why Microsoft added the feature Generic Math with interfaces like
INumber<T>
over primitive types.
Last updated