Creating a Value Object Base Class with `Data.Class` in TypeScript
Hello everyone!
I am trying to model a Value Object using
I cannot do neither
The only thing I could come up with is to create getters for each attribute:
Is there a better way?
I am trying to model a Value Object using
Data.Class, to take advantage of the equality and hashing qualities. I would not like to extend each of my classes that model my value objects from the Data.Class class, but rather, extend from an abstract class called ValueObject which in turn, extends from Data.Class, thus being more explicit in my intent. The problem is that I lose any kind of auto-completion when I instantiate an object from my value object, since I cannot pass generics to Data.Class.I cannot do neither
Data.Class<T> nor Data.Class<{ readonly [P in keyof T]: T[P] }>The only thing I could come up with is to create getters for each attribute:
Is there a better way?
