Skip to content

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

@uladkasach

Description

@uladkasach

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    pit-of-successSomething that prevents bugs in common use cases

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions