How to find Instagram influencers in no time

Want to run an influencer marketing campaign but don't know where and how to start looking for the right Instagram influencers? And… how to find them without breaking the bank? Well, If you are an…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Should I switch to Typescript?

If you’re reading this, you probably already know. But a quick summary never hurts: Typescript is an attempt by Microsoft to make Javascript look and feel more like a proper programming language, specifically adding strong typing. You use the Typescript compiler to convert Typescript back to plain Javascript, so the browser (or Node) will never know it wasn’t Javascript to begin with. This also means that functionally you can’t do anything in Typescript that you can’t do in Javascript.

To illustrate, here’s a simple example. In Javascript:

The same in Typescript would be:

Very spectacular. But what the example shows is that in the Javascript version, you can infer from the toFixed method being called, that the product parameter is an object that has a numeric property called price . In Typescript you make this explicit, which has two huge benefits: better code completion, and type checking.

Because every variable used in the Typescript code is explicitly set to be of a specific type, your IDE (such as Visual Studio Code) will be able to help you along while you’re coding:

The IDE knows all about your foo

And if you’re trying to break your own rules, you’ll know:

And of course, depending on your configuration, the Typescript compiler will also break and tell you to fix this.

So, if you’re anything like me, this will have gotten you in a mild state of arousal. But you might also have noticed that the Typescript example took 60% more code to achieve the exact same thing. While in daily life it won’t be as bad as in this contrived example, it is true that you’ll need to write more code. You might call this inefficient. In my experience you’ll easily make up for this though, by not having to look up variable names, etc.

No wonder Typescript is a divisive issue… It really is a question of preference and priorities. To sum up:

So, if you’re confident as a developer and you have some time to spare, and some good breathing exercises at the ready, I think it is definitely worth your while to try out Typescript. Once you’re past the initial hurdles you’ll love the added code completion options and having a more integrated feel to your code.

If you’re not feeling adventurous, or if you’re working on a deadline, you’re probably better off sticking with Javascript.

Add a comment

Related posts:

Media Garage at Outriders Stage

Short update from our ongoing Studio project — Media Garage — where we support 4 organisations from Moldova and Ukraine. We were very happy that not only founders and managers but also team members…

Will Artificial Intelligence Threaten the Future of Humanity?

Artificial intelligence (AI) has been a topic of discussion for many years, with both excitement and trepidation surrounding its potential impact on society. Some experts believe that AI has the…