Skip to main content

· 5 min read
Denis Souron

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.

· 9 min read
Denis Souron

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.

· 6 min read
Denis Souron

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/

  1. Install Raspberry Pi OS (formerly Raspbian) via https://www.raspberrypi.org/software/
  2. Boot on this OS
  3. Run sudo raspi-config and disable WiFi + Bluetooth (security concerns)
  4. Enable SSH daemon when starting.