deepkit / deepkit-framework

A new full-featured and high-performance TypeScript framework
https://deepkit.io/
MIT License
3.2k stars 123 forks source link

[QUESTION] Does the @marcj/marshal support TypeScript 4.9? #397

Closed vany0114 closed 1 year ago

vany0114 commented 1 year ago

It seems that the @marcj/marshal is now evolving to deepkit, however, we still use @marcj/marshal for serialization/deserialization and we're in the process to migrate our code base to TS 4.9, however, we noticed some issues and it seems it's not working properly with that TS version, and I also noticed that the serialization in deepkit seems to be in development, so what would you recommend, should we also migrate our project to use deepkit? the documentation around decorators seems to be incomplete.

marcj commented 1 year ago

Yes, Marshal is deprecated and entirely replaced with @deepkit/type. The latter should support everything Marshal did support plus a lot more. TS4.9 is not supported, as we wait for Angular to support it first. I've not tested whether TS v4.9 actually works or has major issues with Deepkit's transformer, but I'd go with the safe route and go with TS v4.8. You could try 4.9 though and report your issues. We should probably be able to sort them out in a short period of time.

So, yes, I'd recommend to move to Deepkit, as it is much more stable, more feature-rich, and is much more ergonomic compared to Marshal.

Feel free to report your issues in the issue tracker or ask questions about missing docs in our Discord server.

vany0114 commented 1 year ago

Thanks for the advice and the quick reply! we're gonna evaluate moving to TS 4.8 then since that's supported by @deepkit/type, is there any documentation or examples available? we basically use the @f annotation and the classToPlain and plainToClass apis from the @marcj/marshal package.

marcj commented 1 year ago

The idea is that you don't need decorators anymore for basic type definition, only for validation and fancy stuff like embedding. For these you use "Type Decorators" (see docs). classToPlain(T, data) is now serialize<T>(data) while plainToClass(T, data) is deserialize<T>(data).

marcj commented 1 year ago

I'm going to close this since it was answered

vany0114 commented 6 months ago

Hi @marcj quick question re @marcj/marshal, does @marcj/marshal support Node 18? I don't think so, right?

marcj commented 6 months ago

I don't think anything should break, but honestly I don't know

vany0114 commented 6 months ago

I'm asking because we're migrating to Node 18 and we're having some issues with serialization/deserialization 🤔

marcj commented 6 months ago

too bad. you should update to deepkit, since marshal is dead