Isaaac
1 min readJan 24, 2024

--

May be an unpopular opinion but still not get the thing with TS decorators. I hope it's just that I haven't read the proper examples yet, but from what I see it's messing up all your types and never inferring decorated output types. To me it's unusable unless we still want to code like we were doing in js. It forces you to add runtime checks everywhere to see if something is decorated with something. Whereas an extends will type everything fine.

If a native TS feature forces you to use "as any" or any runtime check on any output, to use it the way it should be, this is not a TYPEscript feature to me.
When I use TS, if my code compiles, it runs.

The potential of decorators is limitless, but the actual implementation sucks (from all literature and examples I've seen so far). But I'm pretty sure it sucks at typing for a reason, because people behind are smart, so might just be a normal limitation ?

Thanks for this article, was interesting, I'm not complaining about it, just trying to understand why people in general want to use these decorators so bad when every things I have seen build with them are not really good

--

--

Isaaac
Isaaac

Written by Isaaac

I do stuff with computer and code and internet and I like it. I'm also a photographer ✨

No responses yet