add custom transformer to make instantiation not a prerequisite for using serialize
and getUniqueIdentifier
#12
Labels
pit-of-success
Something that prevents bugs in common use cases
continuing from #11
Perhaps the only safe way to use serialize and getUniqueIdentifier is with type transformers? (e.g., similar to https://github.com/woutervh-/typescript-is)
Just like that library is able to create guardclauses on the fly, we should be able to figure out what the domain object is without requiring it to be instantiated. (i.e., the only purpose of instantiation becomes typechecking).
--
this would really be the only always safe way to use
serialize
andgetUniqueIdentifier
- as we'd never throw an error.perhaps we should probably implement this change and require custom transformer be used if they want to user
serialize
orgetUniqueIdentifier
, as it will end up failing while passing type checking otherwise - which is not ideal?The text was updated successfully, but these errors were encountered: