Tag: TypeScript

7 Secret TypeScript Tricks Pros Use

1. Type Inference Typescript is smart enough to infer the data types when you help it narrow them down. enum CounterActionType { Increment = "INCREMENT", IncrementBy = "INCREMENT_BY", } interface IncrementAction { type: CounterActionType.Increm...

An ESBuild Setup for TypeScript

Historically, I have despised dealing with JavaScript build tools. For years it seemed to me a frustratingly fragile enterprise; so much so that I spent time building my own tools just to avoid the mess. I am happy to share that this area of the ecosystem seems to finally be maturing. I was pleasant...

Type vs Interface in TypeScript

TypeScript usage in the modern software development industry is expanding rapidly with the emergence of the static type-checking concept in JavaScript. So, the chances are high that you have heard of both Types and Interfaces in TypeScript. However, it’s possible for novice developers to...

10 Best YouTube Channels to Learn TypeScript

Introduction: In the learning journey of a programming language, having access to the right tools and resources is crucial. While documentation and interactive platforms like ChatGPT are invaluable, YouTube has emerged as a popular medium for learning programming languages due to its visual an...

Source Map —  Your Ultimate Guide

What are Source Maps Source maps are files with names ending with .map (for example, example.min.js.map and styles.css.map). They can be generated by most build tools, for example, Vite, webpack, Rollup, Parcel, esbuild, and more. Most of the time, our p...

Practical DDD in TypeScript Factory

Some software developers provide a bunch of superfast code, destroying the scrum board. The two-week-long sprints start on Wednesday, and by Friday morning they already finished all their tasks. I’ve seen this multiple times. And each team needs at least one such girl or a guy to be able to...

Senior Engineering Strategies for Advanced React and TypeScript

React and TypeScript are two of the most popular front-end technologies used in modern web development. React’s component-based architecture and virtual DOM, combined with TypeScript’s strong typing and maintainability, make for a powerful duo. However, building and maintaining complex R...

TIL — Typescript type guards and predicates

n TypeScript, type guards are a way to provide additional type information at runtime, making your code more type-safe and reducing the possibility of runtime errors. They help ensure that you are working with the correct type of value, enabling you to perform operations specific to that type with c...

My Journey into TypeScript: Exploring the Basics and Beyond

In the ever-evolving world of web development, staying ahead of the curve is essential. One of the tools that has gained remarkable traction is TypeScript. As someone passionate about coding, I am currently embarking on a journey to learn TypeScript, starting from the basics and gradually delving in...

Hands-On Implementation of the Raft Algorithm With TypeScript

The Raft Algorithm is a distributed consensus algorithm designed to be easy to understand and implement. It is commonly used in distributed systems, such as distributed databases and file systems, to ensure data consistency and availability. Some real-life applications of the Raft Algorithm inclu...

Use safeParseTo function to Type Strongly your TypeScript Code

Adding TypeScript to JavaScript, it is no longer a choice but an obligation to have a robust code. Let me show you how to strongly type your code with the safeParseTo function. Without Using safeParseTo Let’s imagine, we have a function that accept a string/number list. It d...

Overloading typescript constructor like cpp or Java with a catch

When ever I was looking into the typescript Date class constructor implementation, I always wondered how its constructor signature worked like that, how it can have many signature, how can it work with 1st argument as number or string or an instance of itself. Every time I tried to implement the con...

Rust Trait: A Powerful Alternative To TypeScript Interface

While Rust has a concept of interface, it differs from other programming languages in that it does not use the interface keyword to specify the behavior of classes and functions. Instead, Rust’s closest abstraction pattern is trait. Although these concepts have many differences,...

The 5 commandments of clean error handling in TypeScript

Dealing with errors is an essential part of software engineering. Defining and having strong guidelines on how to handle errors will make your life easier when developing features, but also, and maybe more importantly when things go wrong! At Orus (where we try to reinvent professional in...

We’ve built TypeScript ORM for 821 days then this happened

We went public on Jan 3, had completely humble beginnings and then things went wild, Drizzle went off the charts, through the roof and I can’t wait to tell you more about it. If you’ve been watching us closely — you know we began our journey 7 months ago. We’ve created a T...

Understanding Types, Globals, Interfaces, Constants, and Props in TypeScript

This is the perfect explain Typescript to me like a five year old. I hope you find it helpful. Introduction TypeScript has emerged as a powerful and widely adopted superset of JavaScript in modern web development. It brings static typing, enhanced code organization, and improved developer prod...

6 Advanced TypeScript tricks for Clean Code

Six advanced TypeScript tips will be covered here, along with examples showing how each one works step by step and their benefits. By using these tips in your own TypeScript code, you not only raise the general standard of your writing but also grow your skills as a TypeScript programmer. ...

Practical DDD in TypeScript: Repository

There are not many segments of software development that scare me, except integrations with other systems. Writing code for some business logic today looks easy with Domain-Driven Design. However, writing code on the Infrastructure Layer to integrate some external system like 3rd party API, cachi...

What’s New in TypeScript 5.2?

The TypeScript 5.2 version is planned to be released on the 22th of August . You can learn more details about the release plan here. In this article, I will highlight the most relevant new features. Here is the summary: The new using keyword Decorator Metadata N...

Stop Using any Type in TypeScript

TypeScript is one of the most used programming languages among web developers. It has fantastic language features and allows you to design scalable applications easily. Hence, developers tend to choose TypeScript over JavaScript for their projects. However, there are some common mistakes we need ...

10 TypeScript Tips and Tricks Every Developer Should Know

TypeScript is a superset of JavaScript that allows developers to write safer and more maintainable code. It provides static typing, type checking, and other advanced features that are not available in vanilla JavaScript. In this article, we will explore some of the most useful TypeScript tips and tr...

TypeScript: Adding Type Safety to JavaScript

JavaScript is one of the most widely used programming languages for web development, known for its flexibility and versatility. However, it has a notable downside: the lack of static typing, which can lead to runtime errors and make large codebases hard to maintain. TypeScript, a superset of JavaScr...

Plato would love Typescript Generics!

Have you ever found yourself meticulously outlining a software system’s architecture with your team, only to get derailed in a debate about the details of actual code? It happens all the time, and it’s source hearkens all the way back to ideas of the ancient Greek philosophers — th...

Typescript 5.2 — No More Memory Leaks

If you need a reason to use ES2020 in your project, Typescript 5.1 while it will go outside beta state will be a great opportunity. ES2022 is required for Typescript 5.1 to work. Typescript 5.1 Beta offers some interesting improvements relaxing strict rules, helping out JSX developers. The lang...

Hands-On Implementation of the Raft Algorithm With TypeScript

The Raft Algorithm is a distributed consensus algorithm designed to be easy to understand and implement. It is commonly used in distributed systems, such as distributed databases and file systems, to ensure data consistency and availability. Some real-life applications of the Raft Algorithm inclu...

Creating a Nostr Client in Typescript

In my free time I create generative art in p5js, my current workflow (and a lot of p5js artists) is Write some code to create a piece Export the canvas as a jpg Upload the image to Instagram In theory, this works quite well as it’s easy to reach an audience, although it&rsqu...