From Skepticism to Advocacy: My Journey with TypeScript in Building my Portfolio

When I first heard about TypeScript, I'll admit that I was a bit hesitant to give it a try. I had heard mixed reviews from other developers, with some praising its capabilities and others claiming that it was too much of a hassle to set up and use.

One of the main reasons I was hesitant to use TypeScript was that it seemed like an unnecessary layer of complexity to add to my development process. I was already comfortable with JavaScript and I worried that having to learn a new language and set of concepts would slow me down and make it more difficult to build out my portfolio.

However, as I began to dive into TypeScript, I quickly realized the benefits it offered. Take for example, the ability to define interfaces. This helped me ensure that my code was consistent and that different parts of my application were working together as expected. Here's an example of an interface I created for a Post object:

interface Post extends Base {
    author: Author;
    body: Block[];
    mainImage: Image;
    slug: Slug;
    title: string,
    description: string,
}

Additionally, TypeScript's strong typing system helped me catch potential errors early on in the development process, saving me a lot of time and headaches. Here's an example of a type that was used to ensure that a function only accepted specific input:

function greet(name: string) {
  console.log(`Hello, ${name}!`);
}

greet(123); // This will throw an error because the function expects a string, not a number

I have to say that I am glad I decided to give TypeScript a try, even though I initially had my doubts about it. While there was a small learning curve to get started with TypeScript, the benefits it provided in terms of catching bugs and improving the maintainability of my code made it well worth the effort.

Check out my portfolio website: Link

My Blogs

0
Subscribe to my newsletter

Read articles from Abdullah Ibn Shahin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abdullah Ibn Shahin
Abdullah Ibn Shahin

Experienced Full Stack Web Developer specialising in TypeScript, React, and MERN & MEVN Stacks with expertise in Mobile App Development using Flutter and UI/UX Designer Currently Learning ML and Data Science.