2024-05-02
3293
#typescript
Samuel Olusola
97873
May 2, 2024 â‹… 11 min read

Understanding the dependency inversion principle in TypeScript

Samuel Olusola Software engineer (JS stack, GoLang incoming…) and student of computer science at the University of Lagos.

Recent posts:

JS Logo Over Blue Background

The ResizeObserver API: A tutorial with examples

The use cases for the ResizeObserver API may not be immediately obvious, so let’s take a look at a few practical examples.

Kevin Drum
Nov 5, 2024 â‹… 7 min read
Automate Code Commenting Using VS Code And Ollama

Automate code commenting using VS Code and Ollama

Automate code comments using VS Code, Ollama, and Node.js.

Carlos Mucuho
Nov 5, 2024 â‹… 13 min read
Build A Micro-Frontend Application With React

Build a micro-frontend application with React

Learn to build scalable micro-frontend applications using React, discussing their advantages over monolithic frontend applications.

Harsh Patel
Nov 4, 2024 â‹… 8 min read
Building A Real-Time Chat App Using Laravel Reverb And Vue

Building a real-time chat app using Laravel Reverb and Vue

Build a fully functional, real-time chat application using Laravel Reverb’s backend and Vue’s reactive frontend.

Rosario De Chiara
Nov 4, 2024 â‹… 12 min read
View all posts

6 Replies to "Understanding the dependency inversion principle in TypeScript"

  1. Hi, really nice article! A couple of typos in the code examples. You’re writing log.info instead of log.error when an exception occurs. Cheers!

    1. Thanks for the tip — would you mind pointing out the specific code blocks where the typos occur?

  2. A couple of problems with this principle. High level and low level is vaguely defined. If you apply this to the highest levels, this works fine. But the lower you go, the more this will feel the effects of an extra pointer to resolve or an extra function call. So, make sure that in your language, this results in, as much as possible, zero cost abstractions. Interfaces and Traits are typically fine, but watch out with proxies, abstract classes or any form of wrapper constructs.

Leave a Reply