Category: JavaScript

JavaScript TypeScript Uncategorized

More advanced types with TypeScript generics

Previously, we’ve discussed the basics of TypeScript Generics. This time, we take them to a higher level. In this article, we learn about index types. To do so, we also explore union types, the keyof keyword, and string literal types. Today we also learn mapped types and use them with conditional types. Index types Generics are very useful in many situations. […]

Express JavaScript TypeScript

TypeScript Express tutorial #13. Using Mongoose virtuals to populate documents

This entry is part 13 of 15 in the TypeScript Express tutorial

Throughout this series, we’ve created some schemas and models for documents. We’ve also established ways to define relationships between them. We sometimes find ourselves needing many different properties in our documents. They sometimes overlap each other, and we might want to avoid duplicating the data in the database. Also, we might want to avoid two-way […]

JavaScript TypeScript

Applying SOLID principles to your TypeScript code

The SOLID principles were defined quite some time ago and are still relatable. Their goal is to make our software easier to understand, read, and extend. We accredit this concept to Robert C. Martin from his paper from the year 2000. The actual SOLID acronym was defined later, though. In this article, we go through all […]

JavaScript Testing

JavaScript testing #6. Introduction to End-to-End testing with Cypress

This entry is part 6 of 8 in the JavaScript testing tutorial

So far, we’ve covered quite a lot of different types of tests. Some of them were unit tests or integration tests, where we tested a specific part of our implementation or components working together. In this article, we look into End-to-End testing and perform it using the Cypress framework. The principles of the End to End (E2E) testing The […]

Express JavaScript

JavaScript design patterns #4. Decorators and their implementation in TypeScript

This entry is part 4 of 5 in the JavaScript design patterns

When we are cold, we put on a shirt. If that’s not enough, we put a coat on top. Decorators work similarly. In this article, we discuss the principles of the decorator design pattern and talk about their implementation in TypeScript. We also briefly mention the JavaScript implementation of decorators using Babel. The basics of […]