2 ms·
> They are both TypeScript. I take issue with this position because this seems to imply "PureScript and JavaScript are both JavaScript" is a true statement mer
by KPGv2 10mo ago
> They are both TypeScript.
I take issue with this position because this seems to imply "PureScript and JavaScript are both JavaScript" is a true statement merely because one of them turns into the other with tooling.
- egeozcan 10mo agoI think the point here is that all the TS tooling works with JSDoc without any friction. As long as you don't look into the file, from the tooling perspective, a .ts file and a .js file with proper JSDoc annotations are practically the same.
- aatd86 10mo agoExcept the js files can work in the browser as is.. not the ts one (fortunately I might add, I find ts syntax very loaded at times) Either one is superseding the other one, or they are simply distant cousins, but this is not interchangeable. TS from JSDoc requires a generative pass to. This is a (expected) level of indirection. (unless some tooling does it automatically)
- nosianu 10mo agoTypeScript is indeed Javascript, all you have to do is remove the type annotations. They are not code. TS does have some minor things like enums that need to be transformed and are actual code, but those are very few, and leftovers from early days of TS, and the TS authors regret having implemented them. For many years now the TS philosophy has been that the CODE part of TS is 100% ECMAscript, and only annotations, which are not code, are added. The initial Babel transpiler for TS => JS, and still the most part of the current one, simply removes annotations. It is recommended not to use the few parts that are actual code and not standard JS. They are certainly not needed any more since ES6. People may get confused because the type syntax itself is almost like a programming language, with conditions and all. But none of that ends up as code, it's not used at runtime. One of the IMHO worst design decisions of TS was to bundle type checking and transpiling into one tool. That caused sooo many misunderstandings and confusion.
- KPGv2 10mo ago> TypeScript is indeed Javascript No, no. JavaScript is TypeScript. TypeScript is not JavaScript. > type annotations are not code Of course they are. If they weren't code, then a malformed type would not trigger an error. You can actually solve the eight-queens problem with TS's type system alone. https://lemoine-benoit.medium.com/eight-queens-puzzle-in-typescripts-type-system-4c7ff1693545 https://lemoine-benoit.medium.com/eight-queens-puzzle-in-typ... The type system itself is Turing-complete!