Exploring TypeScript Interfaces: Methods vs. Function Properties

Exploring TypeScript Interfaces: Methods vs. Function Properties

Typescript, as a superset of JavaScript, enhances JavaScript’s capabilities, including the way we define object structures. We’re going to delve into a common misconception: What’s the difference between method signatures and function property definitions in TypeScript interfaces? We’ll break it down with some examples, and explain the subtle differences between these two ways of declaring a method in an interface: 1interface MyInterface { 2 myMethod(): void; // method 3 myMethod: () => void; // function 4} Defining methods in interfaces In Object-Oriented Programming (OOP), methods are the behaviours classes. TypeScript interfaces allow us to specify a contract for these methods. When we define a method in an interface using myMethod(): ReturnType;, we’re telling any class that implements this interface, “You need to have a method of this name, these arguments, and returns this type”. ...

January 9, 2024 · 4 min
Learn AdonisJS pt. 1

Learn AdonisJS pt. 1

Just like many other Node.js backend developers, I spend most of my time building REST API’s with Express.js. It’s a small, very easy to use HTTP library with a huge amount of middlewares and awesome, large community around it. But I didn’t enjoy working with it. Something was missing. Express.js is just a small HTTP library. It accepts requests and returns responses. No matter how well it does it’s job, applications I write are rarely just accepting requests and sending JSON responses. ...

November 12, 2022 · 3 min
The internship story - Guidelines, resources and my experience

The internship story - Guidelines, resources and my experience

In my previous post my previous post, I mentioned that I used free resources on the internet to learn and prepare myself for the internship interview. I want to elaborate more on that here, describe those resources and suggest a learning path that worked for me. The key takeaway of this post is that everything you need to know to land an internship or even a junior level job, is available on the internet. There is plenty of information, tutorials, videos, courses etc. for learning to build apps. You just have to find them, and start learning. ...

July 28, 2022 · 6 min
The first internship, do we all start like this?

The first internship, do we all start like this?

Back in 2017, I was still in college. It was boring and I didn’t learn much. I came to the conclusion that writing PASCAL and C on a piece of paper isn’t going to do much for my future, so I decided to try my luck in the real world. I lived in a small city in a small country in South Eastern Europe. There were a total of 3 (three) mid-sized companies in the entire city that employed all the programmers in the city. They also picked the best and brightest students from the college for paid internships and possible full-time employment. Obviously, I wasn’t one of them, so I took a different route. ...

July 11, 2022 · 6 min
No, you do not have to use Mongodb with Node.js

No, you do not have to use Mongodb with Node.js

Vast majority of beginner nodejs tutorials use mongodb for the database. For simplicity sake, this is fine for beginners. It saves them the hassle of dealing with SQL table relations, so they can just stick any data in and get it out to render it on the page. So, you need to persist some data After learning the basics of building apps with Node.js, you may decide to build an app on your own. The courses and tutorials you learned from taught you Mongodb. It seems like next logical step: ...

May 13, 2020 · 3 min
Difference between var, const and let

Difference between var, const and let

There are 3 ways to declare a variable in Javascript: using one of the keywords var, const or let. Prior to ES6, var used to be the only way to declare a variable. You had no other choice. However, it had some weird and unexpected behavior, which often resulted in hard to debug errors. Intuitively, you would think variable declared with var is block scoped. Variable declared in, for example, if statement, or a for loop, is visible only in the scope of that statement or loop. ...

May 6, 2020 · 3 min