Because it's possible to do things in plain JS that it isn't possible to do in TS
this should be counted as deficiency, bug, or todo
TS will mangle this valid JS code - making it do something different:
ya like I said, whether 'a' should compile to 'b' is another story, even babel itself has many way to compile the same JS code, and by this logic should we say JS itself is invalid JS?
It really depend on the understanding of the author, they could be right, they could be wrong
Yep, the problem is (as I said) - the widespread misunderstanding of what 'TS is a superset of JS' actually means. I've lost count of the number of times I've heard people say that 'all your existing code written in JS will run with no problems in TS, you can just add the types gradually' - and then watching the ensuing chaos.
I've written libraries for JS that some really good TS developers I know have tried to make compatible with TS... they gave up!
TS can certainly be the right tool in some situations, but other situations it actually blunts the power of JS.
I mean the properly typed and improperly typed will still produce the same code
the type notation will not affect the final JS code emitted
for example If TS decide to compile
a
tob
, with or without the type annotation, the result will still beb
whether
a
should beb
, whether it makes sense or not, is another storyTS will mangle this valid JS code - making it do something different:
this should be counted as deficiency, bug, or todo
ya like I said, whether 'a' should compile to 'b' is another story, even babel itself has many way to compile the same JS code, and by this logic should we say JS itself is invalid JS?
It really depend on the understanding of the author, they could be right, they could be wrong
Yep, the problem is (as I said) - the widespread misunderstanding of what 'TS is a superset of JS' actually means. I've lost count of the number of times I've heard people say that 'all your existing code written in JS will run with no problems in TS, you can just add the types gradually' - and then watching the ensuing chaos.
I've written libraries for JS that some really good TS developers I know have tried to make compatible with TS... they gave up!
TS can certainly be the right tool in some situations, but other situations it actually blunts the power of JS.
The misunderstanding is people think by copy and paste think will work
No, by superset it means the compiler understand JS syntax
it has nothing to do with the effort of the developer, it is not about the developer!