It's funny how TypeScript proponents seem to acknowledge that Java is bad and yet they consistently fail to point out in what way it's inferior to TypeScript.
I've worked with TypeScript for over a year and before that, I worked with Java for about 2 years at university and if anything, Java is superior to TypeScript because it has a much more consistent type ecosystem. Pretty much every Java project uses the same URL class to represent URLs for example. TypeScript has no consistency between libraries and projects - This will be TypeScript's demise; once developers realize how empty and meaningless supposedly universal type names are as an abstraction, they'll be begging to go back to JavaScript.
Enforcing a type system which is consistent between all projects is as pretentious as using global variables and yet that is the only way forward for TypeScript as an ecosystem.
For me the single best feature of typescript is that it's optional.
It has the rapid prototype capability that I love in Python and JavaScript. But once you're past the experimentation phase, you can make your measurements, write your more detailed design, do a little refactoring, and then "lock things into place" with typing.
I haven't used Java in a while, but how easy is it to write a working Java application without really knowing what you're building yet? (And I know people will say you're never supposed to do this, but I've found that practical experimentation and working examples is a very powerful part of the design loop)
The type system is like a chain. It's only as strong as its weakest link. A permissive type system which allows for an 'any' type and lets functions specify multiple possible return types is about as useful as no type system at all.
At the other extreme, a rigid type system is not good either because it makes it harder to integrate your system/module with third party systems/modules developed by other teams/companies. This is because other teams might be using completely different programming languages and their type system is extremely unlikely to be compatible with yours - This means that if they want to integrate with your code, they need to do a lot of work to convert their own types to match yours and the result just looks ugly; their project ends up with redundant types/interfaces that sound and behave almost the same but are different in ways that are almost impossible to describe let alone understand.
For example, let's say that I import two modules; both of them expose their own `URL` interface. Now both modules chose the same name for interface but one of them exposes a `query` property as a string, but the other one exposes a `query` property as a Map. How do you reconcile these two conflicting types within your system? The result just looks ugly and confusing no matter what you do.
Do TS folks really attack Java specifically? Why? That doesn't make much sense to me. By and large when I hear TS aficionados speak they compare TS to vanilla JS and don't mention Java at all.
They use this excuse to try to convert experienced Java developers who've seen the light after switching to JavaScript and who are desperate to not go back to the static typing hell hole that they came from.
I'm one of these people (2 years of Java at university).
The thing is that I know exactly why so many developers like statically typed languages. I've been there in 2006 when I switched from ActionScript 2 to ActionScript 3; I remember clearly the following 2 years of ActionScript 3 when I really thought I loved static types.
Unfortunately, I also remember the years after switching back to JavaScript and the huge productivity increase that followed. The problem was not dynamic types, it was my lack of experience.
That's why I cannot go back. I'm using TypeScript at work now and although I really love the company mission and I feel that I'm producing really great work, I don't think that I can stay there much longer because TypeScript slows me down and makes me hate coding.
I've worked with TypeScript for over a year and before that, I worked with Java for about 2 years at university and if anything, Java is superior to TypeScript because it has a much more consistent type ecosystem. Pretty much every Java project uses the same URL class to represent URLs for example. TypeScript has no consistency between libraries and projects - This will be TypeScript's demise; once developers realize how empty and meaningless supposedly universal type names are as an abstraction, they'll be begging to go back to JavaScript.
Enforcing a type system which is consistent between all projects is as pretentious as using global variables and yet that is the only way forward for TypeScript as an ecosystem.