loading...
Cover image for Is Typescript harder than JavaScript?

Is Typescript harder than JavaScript?

jwp profile image John Peters Updated on ・3 min read

Comparisons

JavaScript is not that easy to learn (in my opinion). Of course, once the light switches on, it's a simple key/value pair, function passing oriented language. It takes about 1 year to get going full steam.

Indeed, just like C# or Java; which both take about a year to feel comfortable, the pattern of 1 year to fluency emerges.

Typescript is no different, it too takes about 1 year to become fluent.

Foreign Language Interpreters

Did you know that people in the U.S. Army that are to become language interpreters are sent to language school for 1 full year? When they arrive, they are told that they will not hear English spoken in their class again! They go to school 8 hours a day for a full year. Talking about... "total immersion".

One Year to Fluency

If we don't know JavaScript; then it may be easier to learn TypeScript. For example, one finger typers are at a disadvantage when taking a Typing class. Old habits are hard to break; but starting without any pre-knowledge forces us to learn bit by bit in a prescribed manner. One year, according to the Army, is the right amount of time to become Fluent.

What is Fluent?

If we study a foreign language, there are distinct phases we pass through.

  • We must hear it spoken and emulate what we've heard, being informed of the meaning in our native language.
  • We must learn to read it, making a dictionary in that language an invaluable tool.
  • We must learn to write it. (Except when we only read it)
  • We must learn to speak it. (To communicate with others)

The speaking part is the most difficult. It requires us to synthesize speech, at will, and without hesitation. Each sentence is a created pattern of words, inflection and sense. We must make sense to the listener.

Shortcuts?

If we already know Java, C# or JavaScript, then our 1 year learning time is cut in half.

Typescript builds upon our knowledge of those languages. It does it in a different way e.g. Type declarations after the variable declaration (instead of before as in C# and Java). But it's not too difficult to understand the differences.

// Type declaration, after the variable name.
varName:string;
varName2:number;
varName3:Person;
varName4:Address;

Only 6 short months of daily use will make us mostly fluent in Typescript if we already know C#, Java or Javascript.

Just be Persistent

Adding Typescript to our list of languages only helps our long term career. We feel Microsoft (who owns GitHub), will continue to offer enhancements for the foreseeable future. Google, who adopted Typescript as an "official internal language"; based Angular on it. They will continue supporting it (like Microsoft) for the foreseeable future. These two giants in the industry lend massive amounts of credibility to Typescript.

Be persistent, practice it daily, and use it daily. Within a year we will feel totally comfortable with Typescript.

Naysayers

It seems that about 50% of JavaScript people absolutely hate Typescript. This is understandable, in that; many OOP folks felt the same way about JavaScript in the early days.

It's not uncommon to dislike something new in our "comfortable well known space". For example, 40 years ago when third generation languages arrived, there was a cacophony of mixed reactions. Naysayers represent normal human behavior to something new and possibly disruptive.

Keep Focus

Don't allow opinion to sway your goals of picking up a new skill and adding value to your career. Typescript is a great language, which was created and supported by one of the kings of programming languages... Microsoft.

Disclaimer

I do not work for or totally trust Microsoft. At one time I was a dye-in-the-wool advocate for their products, but not any longer due to their "throw-you-under-the-bus" attitude. Anyone recall WPF, UWA, Silverlight, Windows 8, Windows Phone or the goofy IE browsers that stunk up the world? Don't get me started please.

Microsoft Research for Programming Languages

JWP 2020

Discussion

pic
Editor guide
Collapse
akashkava profile image
Akash Kava

It seems that about 50% of Javascript people absolutely hate Typescript

Since TypeScript is from Microsoft, everybody who hates Microsoft, by default they hate TypeScript.

The best part of TypeScript is, for consumer of library, when dealing with any JS library, some of them are so poorly documented, it becomes difficult on what parameters are required to send and what will be the result of the function. With TypeScript, users can consume libraries without any documentation most of the time.

TypeScript is really useless of is-even kind of library, usually single developer repository, typescript is huge overhead.

But when you are dealing with a huge team, everybody working on multiple components, no body has enough time to document everything, a tight budget on UI is always a big constraint, at this time TypeScript makes a huge difference.

Anybody who argues that TypeScript is not compiled, and at runtime all types go away etc, eventually at machine language level, everything offered in higher level goes away, all are just numbers.

Collapse
joelbonetr profile image
JoelBonetR

I would like to see the source of this numbers but apart from that, typescript is ok if you use it without standard linting, better than JS of course, it's done just to avoid some issues that js already has.

The worst part is that even you code typescript you'll need to "compile" (it's not actually a compilation but a transpiling, anyway people call it compiling for an unknown reason) it into JavaScript for browsers to interpret it.

You can't of course, shut down js support because performing simple tasks with typescript could be useless. Only on big Apps you can unleash the typescript good behavior. The way to go so, it's to upgrade JavaScript into something more like typescript with time, adding some optional init config to use this extra features as no one want to see their app broken due to the addition of static typing and so.

Migrating from a language to another is not easy, look at python for example. There were tones of big Apps using 2.x and then boom, new 3 version with no support for 2.x to migrate and no one-click upgrade tools. Even python became popular for the beginners (you know, easy developing and test such as PHP but more trendy), tones of companies don't use it because putting effort and money and teaching teams into it could be harmful if they decide to add version 4 with no support for 3.

This same happen on JavaScript world (including typescript of course) with libraries and that's the reason is not recommended to rely on third party libraries when building something serious for production.