News for hackers. Stuff that matters.
Re:All About E: The Language That Infiltrated JavaScript by neongreen on Thursday October 27, 2022 @08:17AM (#33356425)
Map is in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

TypeScript is designed in such a way that type annotations can't influence the runtime behavior. This is unlike e.g. Haskell, where types can drive code generation. Happy to elaborate more if necessary.

This means that transpiling TypeScript to JavaScript consists merely of stripping the type annotations + transpiling some of the syntactic features that might not be supported by the target JS version.

The "Type Annotations" proposal (https://github.com/tc39/proposal-type-annotations), IIRC championed partly by the TS team, will allow type annotations with almost-TS-like-syntax in plain JavaScript, which will make the "stripping type annotations" step unnecessary. You would still use the TS tooling to actually type-check the code, though.

Which exact part of TS do you want to be built into browsers?

Re:All About E: The Language That Infiltrated JavaScript by indocomsoft on Thursday October 27, 2022 @08:54AM (#33356760)
Do you mind elaborating more on Haskell's types driving code generation? Genuinely curious
Re:All About E: The Language That Infiltrated JavaScript by wruza on Thursday October 27, 2022 @12:04PM (#33359613)
The regular type-based polymorphism/overloading, afair. Just like in C++. Typescript has a way to simulate it, but the code remains the same as if there were no types/overloads. https://www.typescriptlang.org/docs/handbook/2/functions.htm...
Re:All About E: The Language That Infiltrated JavaScript by trinovantes on Thursday October 27, 2022 @09:22AM (#33357103)
There's still non-const enums generating runtime code

I think it would be huge if some future nodejs/web browser can parse native TS so we no longer need to deal with the mess of dev tools like ts-node and babel and wonder why some folder structure or sourcemap is not working