serializr
serializr copied to clipboard
add support for generic types
export class A<T> {
@serializable(alias('foo', object(???))
public Foo: T;
}
Does the raw type handle this?
I would say that it doesn't. The raw type, the way I read it, would only work if T were an interface. If T were an object with methods associated with it, then the raw type would be insufficient.
you can perform any logic that is not possible with the standard types using the custom type and applying your own methods for serialization and deserialization, the latter can also be performed asynchronously.
see e.g. this test case: https://github.com/mobxjs/serializr/blob/e46f7980d4a3db201ce7f75c9f3b235acdc7c61f/test/typescript/ts.ts#L494