News for hackers. Stuff that matters.
Re:TypeScript please give us types by vbezhenar on Friday July 07, 2023 @04:52PM (#36638147)
TypeScript is not JavaScript with type annotations. One of the modes, may be. TypeScript supports emitting old JS constructions which look nothing like original typescript code. So it's more like type annotations + babel. Adding one more thing to this set. Extremely useful thing. I think it's a good idea. I miss it. It's crazy that I can't JSON.parse string into typed structure safely. Every other language can do that.
Re:TypeScript please give us types by andix on Friday July 07, 2023 @04:58PM (#36638218)
No, this is not crazy, this is the design goal of TypeScript.

If you want a statically and runtime typed language in the browser, you should not use typescript. Use Kotlin, Rescript, …

Re:TypeScript please give us types by mrloba on Saturday July 08, 2023 @04:42AM (#36642570)
You can easily parse json into types using something like typebox. Not only does this work, it works much better than many other languages. Have fun trying to represent even a simple patch request, or discriminated union, in something like c#