Refactor serialization

This commit is contained in:
schmelczerandras 2020-10-07 10:04:05 +02:00
commit b3da27e73b

View file

@ -0,0 +1,16 @@
import { SerializableClass } from './serializable-class';
import { serializableMapping } from './serializable-mapping';
export const serializable = (type: SerializableClass): any => {
if (!serializableMapping.get(type.name)) {
serializableMapping.set(type.name, {
constructor: type,
overriden: false,
});
}
Object.defineProperty(type, '__serializable_type', { value: type.name });
Object.defineProperty(type.prototype, '__serializable_type', { value: type.name });
return type;
};