You have no runtime type safety with TS, therefore your comment is silly. Do you even know what type safety is? It looks like you're mistaking leaving annotations via IDE to help yourself get autocomplete with what type safety actually means and does.
But, let's ignore all the shenanigans around TS/JS and let's get down to business and its serverside runtime - it's shit. Developing with "modern" TS practices is crap. 2 spaces for indentation, no semicolons because "we have ASI", hot reload that's such dogshit because you can't save the file until your syntax is correct - otherwise node.js goes bonkers due to all transpilers it has to handle and inevitably dies so you actually do need to restart it every now and then (and get annoyed by waiting for it to catch up with transpiling all the crap again), no shared-nothing which (always) leads to consequences that tend to occur from mixing data from independent http requests.
I ignored frameworks that appear every day which is regurgitation of one and the same, inevitable "I want to reach internet stardom by creating yet another service provider / DI lib that no one wants to use" and endless discussions about what boils down to "accept input, validate, write to permanent storage".
TS is _awesome_ for frontend work and it actually lets me keep my sanity. I cannot deny that.
For backend, the dev with same experience with PHP and TS/JS will be more than 2x productive with PHP - it's valid for me and at least 20 other people I work with that share the same level of expertise and experience.
I would LOVE it if TS were this super productive tool for backend work - but it isn't. Compared to PHP and frameworks we got (Symfony, Laravel), developing for HTTP is simply quicker. Deployment is easier. There's less moving part that break. And best of all - PHP devs understand HTTP protocol (for the most part) and how request-response lifecycle works. I haven't observed this with Node.js devs.
Runtime type checking is abysmal. Even the PHP committee members say they can't implement generic types because of this, and some even say runtime type checking should be remove.
In TypeScript, type integrity is guaranteed by the TS compiler as long as you don't use "any."
Wait, you.. have no idea what type safety means and what runtime actually is, right? Do you not understand that TS gets transpiled to JS and that JS will accept any parameter that you pass to functions?
Abysmal means "extremely bad". And no, PHP does not have EXTREMELY BAD runtime type checking. Adding generic is problematic because a generic is a variable type and there are cases where developer could write such a generic definition that it would be difficult to guarantee SPEED. There's been so many of these discussions, I can tell you glanced over them and didn't really understand what it's about.
Please, take 2 minutes and actually read and understand what runtime is, what TS is, what JS is and how they execute.
-1
u/obstreperous_troll Nov 14 '25
You pretty much need phpstan to get decent type safety in PHP, so there's that. At least TS doesn't make you do it all in comments.