About TypeScript

I didn’t touch TypeScript once in the last 3 years. I stopped using it when I changed my job, from Angular 4 back to jQuery, AngularJS, and forth to VueJS.

  • Did I miss it? Not once.
  • Did I like it when I had to use it? I did.

But now my opinion on TypeScript is that it works like a self fulfilling prophecy. You think you need some control on the types of values you pass around in your application, and, in fact, as soon as you write a line of TypeScript, the linter first, and the compiler later, will immediately spot so many type errors. If you think about how many lines you wrote in JavaScript in the past, without any sort of type checking, they must have been all wrong!

Well, not really. The simplicity and strength of JavaScript is it lacks type checking. I wrote millions of lines of JavaScript, and not many of them with errors. I already know how to protect me from most of them. While developing, the JavaScript linter and the JavaScript test runner will immediately spot whatever I mistook. But also TypeScript needs a linter and a test runner, so that they do not represent a price for the lack of type checking.

While running… well, while running TypeScript is JavaScript and loses any notion of type. Surprising, but true. TypeScript only checks types at compilation time. You should validate whatever data enter into and exit from your code. For example, using Ajv to validate the JSON schemas of the responses you get for requests issued to API endpoints. Again, you need data validation in any case, so it’s not a price for the lack of type checking.

In the end, it seems to me that the benefits of TypeScript are less relevant than the drawbacks. Which is essentially one: development slowness, for having to get types right, when wrong types are hardly so subtle errors that you wouldn’t detect otherwise.

Ship

Recently, I recovered an old piece of JavaScript code I wrote more than 10 years ago.

It’s a simple game where you control a (conceptual) spaceship.

You are under a continuous attack of red balls, which you seem to attract.

You get a chance to survive yet a bit more, by shooting at them before they hit you.

But don’t hit blue balls before they reach you, otherwise you won’t recover some much needed energy.

You shoot with the SPACE bar and aim with the mouse pointer.

Enjoy

About external improvements

Do you know Outline?

Lately, I started using it to skip over so called soft paywalls. It works most of the times.

But today, unexpectedly, it resuscitated dead content too!

Look at the following snapshot of a passage in an interesting article about software architecture with microservices:

https://segment.com/blog/goodbye-microservices/

Look at how the second paragraph ends: “A sample payload looks like the following:” and how the next paragraph begins: “As events were consumed from the queue,“. Something is clearly missing. Where is the payload sample? Nowhere to be found.

Completely unrelated to that issue, I decided to open the page in outline, because I remembered I had seen it was possible to add annotations to transformed pages.

To open a page in Outline is extremely simple, just prefix its full URL with “https://outline.com/” and the service will present to you the transformed page at that URL.

What a surprise when I scrolled through the same passage and saw this:

https://outline.com/asskU

For some reason, Outline was able to resuscitate the dead content, but it got the section title wrong. (sigh, a minor drawback).

Do you know the Web Archive?

I researched a bit in its captures of the microservices article (almost 200, as of today) and found out that the payload content died between the 28th of March 2020 and the 23rd of April 2020, as yo can see from these captures:

28 March 2020

https://web.archive.org/web/20200328190530/https://segment.com/blog/goodbye-microservices/

23 April 2020

https://web.archive.org/web/20200423005607/https://segment.com/blog/goodbye-microservices/

But, wait a moment. Look at the section title in the capture of the 28th of March: “Why Microservices work worked”. Outline’s error seems so much minor now. So much so that the original page got it wrong too.

Do you know Hypothes.is?

I was going to end this article with a link to the Outline page with my worthy annotations, but it turns out that Outline URLs are broken, apparently. This page https://outline.com/asskU doesn’t work today.

However, the annotation service is provided by Hypothes.is. If you have Google Chrome, you can install their excellent browser extension, and navigate to the “official” Segment article to see my annotations, and add yours, if you like.

My annotation is here