Member-only story

How to apply SOLID principles with Typescript in an easy way

Marcos Henrique da Silva
13 min readOct 4, 2021

--

In this article we are going to talk about SOLID principles and how to use it in your Typescript projects!

Let’s make it solid (drums here…)

Common question in interviews, a topic that every software engineer knows or pretends to know and a good topic to review its principles from time to time…

What is SOLID?

Solid is a collection of principles (or subset to be more precise) promoted by Robert C. Martin and in short can be defined as:

  • S: single responsibility
  • O: open closed
  • L: Liskov substitution
  • I: Interface segregation
  • D: Dependency inversion

Let’s see each of them in practice, with Typescript. First let’s configure a basic project (practice coding helps you learning!)

As usual, the source code can be found in the end of my article but for this one I would highly recommend to read to understand the code.

Configuring your Typescript project

To configure your Typescript project, make sure you have node installed in your computer and create a folder to work on. In my case, the folder is called solid-with-typescript.

If you already know how…

--

--

No responses yet