r/webdev • u/gece_yarisi • May 18 '25
Discussion I wonder why some devs hate server side javascript
I personally love it. Using javascript on both the server and client sides is a great opportunity IMO. From what I’ve seen, express or fastify is enough for many projects. But some developers call server side javascript a "tragedy." Why is that?
193
Upvotes
View all comments
Show parent comment
1
u/c-digs May 21 '25 edited May 21 '25
I don't have to imply; I can explicitly state: a typed runtime will not allow the incorrect type to be handled and will throw an exception on a type mistmatch because it does not lose type metadata in the build process and it enforces those types at runtime.
Will fail on this payload:
Because
"twenty seven"is a string. (In fact, it will fail at serialization automatically without additional effort because the serializer can introspect the type and see that astringcannot fit into anint)JS will accept this payload and thus it is necessary to create a schema validator using tools like
class-validator, Zod, etc. It doesn't matter that at dev, time, TS prevents you from doing this; at runtime, the TS gets erased and it's only JS and JS will happily accept that payload and process it.The difference is that this type checking is free on typed runtimes like Java and C# by virtue of defining the type and retaining the type metadata at runtime. The same as if you used Typia in TypeScript because Typia inlines the type information at build into JS.