Top Articles of the Week - 2nd of Sep 2022 - All Things Typescript
Good afternoon; I hope you had a fantastic week. Earlier this week, I announced I am separating the hand-curated section of my newsletter to a dedicated post on its own, and this is it. Here, I will send out, every Friday, articles that I have hand curated for you to read and continue in your journey to understand and master Typescript and its Typing system.
Without further ado, let's get started:
Top Articles of the Week - 2nd of Sep 2022
How do you test whether a bird is a duck? One approach would be to ask a series of questions, and the answers would dictate whether it’s a duck:
Does it look like a duck?
Does it walk like a duck?
Does it quack like a duck?
If the answer to all those questions is yes, then we can conclude it must be a duck. We are checking whether the bird in question models the behavior we expect from a duck, and if it matches up, we can then conclude it’s a duck with a certain level of certainty. This is popularly known as the duck test, and Typescript type checking operates similarly. This is known as structural typing or property-based typing.
by Miroslav Jonaš
Recently we had a significant performance improvement in our linter rule. In some benchmarks, the increase was up to 100x! While one would expect such a dramatic change to result from implementing a sophisticated algorithm, the reality is that this resulted from minor tweaks. Like the butterfly effect — changing a few lines of code created a ripple effect that tremendously improved the overall performance.
by Nic Jennings
As soon as you start writing more advanced types such as Generics or Conditional Types in TypeScript then it should become a crucial step in checking that your type is doing exactly what you expect. Testing Types is a little different to writing your normal Unit Tests as we are testing untranspiled code.
There are three main options when it comes to testing types: Using a tool like dtslint, tsd or making use of the @ts-expect-error comment. I will be covering @ts-expect-error as this is the easiest way to get started and it requires no additional tooling.
The next step to learn how to use functional programming with Typescript is to understand the concept of Immutability.
If we go by the dictionary description we can simply say that Immutability means “not capable of or susceptible to change”.
Having a smaller website makes it load faster — that's not surprising.
What is surprising is that a
14kB page can load much faster than a
15kB page — maybe
612ms faster — while the difference between a
15kB and a
16kB page is trivial.
by Maxsuel Silva
In today’s experiment, I want to share with you how to build a few features of Git with TypeScript. Of course there would exist better ways to do it, but here’s how I can see and solve the problem. This is a simplistic point of view of a complex thing, I hope you enjoy it.
by Carlos Fernando Arboleda Garcés
Another good decision is to add a test framework or library to your project, and it’s not a secret that Jest is currently the most used framework and is a good choice since it has a powerful built-in assertion library.
by Kayode Adeniyi
Optimization involves improving the response time of your API. The shorter the response time is, the faster the API will be.
The tips I will share in this article will help you reduce response time, lower latency, manage errors and throughput, and minimize CPU and memory usage.
by Tate Galbraith
With the advent of elegant, full-service IDEs there are now fewer and fewer command-line interactions by developers. When you can install a package or manage files from a pretty UI why would you need an arsenal of outdated shell tricks? If you’ve ever run into a problem that couldn’t be solved by a fancy IDE then you’ll understand why having these tools at your disposal is of paramount importance.
In this article, we’ll discover some simple, yet incredibly effective shell shortcuts and commands. Using these tips you can troubleshoot errors quickly, run commands faster and execute searches with minimal effort.
By Netanel Basal
Fortunately, starting from version 14.2.0, this is made seamless by the Angular CDK. A new module named @angular/cdk/listbox provides directives to help create accessible custom list boxes.
That’s it from me and I hope you found the above list enlightening. I hope you have a fantastic weekend and see you next week.