-
For non-primitive types we need to use There is actually some metadata injected by the TypeScript compiler that we could use to shorten this down to
Looking at another project, TypeORM it has a References:
May or may not be viable, but it looks cool. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I definitely looked into this - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties One of my first iterations tried to use reflection but we found the double indexed map to be better. It was also important for this to be That said, knowing that a property value type is |
Beta Was this translation helpful? Give feedback.
I definitely looked into this - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties
One of my first iterations tried to use reflection but we found the double indexed map to be better. It was also important for this to be
zero-dependency
(IDK why - but it is). IIRC we found that to do this we would need the decorator on the class, which is completely different from how property decorators work and we ran into issues with that approach as well.That said, knowing that a property value type is
Serializable
is interesting.