5 ms·
Decorators, interfaces, namespaces, readonly, private and there is probably more corner cases. Typescript compile to JavaScript and it smell like lock-in. In fl
by Chyzwar 10y ago
Decorators, interfaces, namespaces, readonly, private and there is probably more corner cases. Typescript compile to JavaScript and it smell like lock-in. In flow you can simply strip type annotations, and you are back to pure JS.
- johnfn 10y agoDecorators are ES7 stage 1 and can be found in Babel. (They were actually demanded by the angular team.) Interfaces are types. Namespaces are namespaced types. Readonly and private are type modifiers. You strip out all of those and you have a working JavaScript program. I don't understand why this myth persists.
- bakkoting 10y agoDecorators, and class fields, are pre-stage-4 ES proposals. That means they are not part of JavaScript. Moreover, what ends up eventually landing, especially in the case of decorators, is unlikely to work quite the same as what TypeScript implements. So "Typescript has no additional features over (ES6+) JavaScript that are not part of the type system." is just false. (Babel has plugins for all kinds of things that aren't part of JavaScript. The team is working on expressing more clearly which plugins are for experimental features and which are settled.)
- johnfn 10y agoYou're moving the goalposts. GP was concerned about MS nefariously introducing vendor lock-in by implementing a bunch of their own proprietary features. I've demonstrated pretty clearly that 1. It's not MS's implementation - it's an implementation of an ES proposal. 2. For the one example you could find, MS didn't even want to do it - it was requested by Google for Angular and done as essentially a compromise. If you browse the TS repository, you can find issue after issue of the TS team refusing to add features that aren't part of the ES standard. I think this shows fairly definitively that this is not a case of MS trying to lock you in to their product.
- bakkoting 10y agoI'm not making a case for or against TypeScript; I'm just concerned that people be aware what is and is not part of JavaScript. You said that TypeScript had no additional features except types. That's all I'm responding to: I'm pointing out this isn't the case. Class fields are, currently, not part of JavaScript. Neither are decorators. (We're working on it - but actually a concern which has come up is that we might end up with something which breaks TypeScript, because the proposals are still in the early stages and therefore subject to radical changes.)