Skip to content

example for TypeSerializer<TSerialized, TOriginal> optional properties? #13

@janseng1970

Description

@janseng1970

Hello,

is there any example for using @Serialize.Custom with this optinal properties in the TypeSerializer<TSerialized, TOriginal> interface?

/**
 * _Optional._ Original type constructor function.
 * Default: Value of `design:type` for given property.
 */
type?: Constructable.Default<TOriginal>;
/**
 * _Optional._ Property type descriminator function.
 * Used to narrow type constructor function (e.g. for union types)
 * @param serialized Serialized value
 * @returns Original type constructor function
 */
discriminate?(this: void, serialized: TSerialized): Constructable.Default<TOriginal>;

I google the code go in deep for the inflate and deflate function and can not even find, that this two properties are used. I want to use the discriminate function to map the name of a type, stored in a serialized string property to a type via a "typemapper".

Thanks for help!

Georg

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions