Integrated into ES2020, present since 2018 in Babel, and since version 3.7 of TypeScript, optional chaining is an operator widely used today. Although the usefulness of such an operator is undeniable, let's explore together the biases and bad practices that can emerge from its usage.
Qu'est qu'on pourrait améliorer sur Angular ?
Je vous propose quelques fonctionnalités qui pourraient améliorer la Developer eXperience et le framework dans sa globalité.
Leveraging Discriminated Unions in TypeScript
What are we talking about?
In TypeScript, it is possible to define types in several ways: interface, class, enum, the type
keyword, as const
, and more. In this article, we will focus on types constructed from a discriminated union and the advantages of such a practice. In TypeScript, unions are created using the |
symbol (e.g., type Union = A | B | C
). The term "disjoint" is not accidental because, unlike polymorphism, the types we will use may have nothing in common.
Pattern Matching in JS?
Unfortunately, it is not (yet) possible in JavaScript, nor in TypeScript. But we can try to get closer to it, especially by separating the identification of a scenario from its execution. The goal is to enhance readability and bring the code closer to the problem it solves. To illustrate this, we will use the example of processing a blog article (adding, deleting, publishing, etc.) based on the information contained in the article. Additionally, I suggest we take it step by step so that you can apply this refactoring in your code.
Pi-hole : Take back control of your network
Get started
This is a step-by-step guide to install Pi-hole on a Raspberry Pi. I will only use IPv4 as IPv6 doesn't provide significant benefits for local network. Please consider reading pi-hole's official documentation : https://pi-hole.net/
- Install Raspberry Pi OS (formerly Raspbian) via https://www.raspberrypi.org/software/
- Boot on this OS
- Run
sudo raspi-config
and disable WiFi + Bluetooth (security concerns) - Enable SSH daemon when starting.