Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom transformer to make instantiation not a prerequisite for using serialize and getUniqueIdentifier #12

Open
uladkasach opened this issue Sep 8, 2020 · 1 comment
Labels
pit-of-success Something that prevents bugs in common use cases

Comments

@uladkasach
Copy link
Member

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 and getUniqueIdentifier - 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 or getUniqueIdentifier, as it will end up failing while passing type checking otherwise - which is not ideal?

@uladkasach uladkasach added the pit-of-success Something that prevents bugs in common use cases label Sep 8, 2020
@uladkasach
Copy link
Member Author

note, this would also be an alternate solution to #8

so maybe the decorate function would only define .UniqueIdentifier s?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pit-of-success Something that prevents bugs in common use cases
Projects
None yet
Development

No branches or pull requests

1 participant