He compares it to the JS/TS relationship.
He compares it to the JS/TS relationship.
He also sells the language differently from any other language that also compiles to native via C++, like Eiffel and Nim among others, due to conflict of interest to have WG21 chair propose yet another take on C++.
typescript
function add(a: number, b: number): number { return a + b };
javascript function add(a/*: number*/, b/*: number*/)/*: number*/ { return a + b };
cppfront add: (a: float, b: float): float = { a + b; }
cpp float add(float a, float b) { return a + b; }Is this true in the general case? I thought there were typescript features that didn't have direct JavaScript alternatives, for example enums.
So, yes, you can't just strip types, but it's close.
That guarantees that the types do not determine the output (e.g. no const enums), not that you can "strip" types to get the same output.
Decorators would be another example. (Though they have always been marked experimental.)
And of course JSX, but that's not a TypeScript invention.
You can see where CPPFront inserts a `cpp2::move` call automatically, and how that differs from a superficially equivalent Cpp1 function.
OP is right, TypeScript is a whole new syntax, and it's shtick is that it can be transpiled into JavaScript.