Build Better and Faster Bundles with TypeScript and Express using tsup
| | |

Build Better and Faster Bundles with TypeScript and Express using tsup

Introduction Forget about ts-node and nodemon, tsup is the way to go. It is a command-line tool that allows you to bundle Typescript code with performance in mind. It uses esbuild under the hood, which is a fast bundler and minifier. Get your entire typescript project bundled with a command that is as simple as…

How To Extend Express Request Interface in Typescript
| |

How To Extend Express Request Interface in Typescript

The problem You will likely be caught in this situation when you create middleware that processes the request data before it reaches the resource route. An example of this is JWT, where you will need to decode the token before every request, and put in the decoded data somewhere. In Javascript, it would have been…

6 Awesome Tricks with the Spread and Rest Operators in Typescript and Javascript Objects
| |

6 Awesome Tricks with the Spread and Rest Operators in Typescript and Javascript Objects

Introduction You may have seen this syntax in Typescript and Javascript Projects before: if you have used React, then you have very likely encountered this syntax a couple of times when passing the props from one component to another. The support for the spread and rest operators was added since: Typescript 2.1 and onwards Javascript…

Cannot start React App after installing Storybook? Here’s how to fix it
| |

Cannot start React App after installing Storybook? Here’s how to fix it

The Problem When Starting React You may have come across this issue when starting your react app after installing storybook: which is one hell of a message to read! but this gist of it is this: React uses a specific version of babel-loader, which has been overriden by storybook. With an incompatible version installed, our…

How to Configure a Path Alias in a React Typescript App for cleaner imports
| |

How to Configure a Path Alias in a React Typescript App for cleaner imports

Introduction As your Typescript React project grows with everything neatly separated in their own folder, the importing processes starts to become messy. This is specially true if we are following a project structure like react-bulletproof. Problem Your project strucure may look like this: and for us to import Button.tsx in TodoItem.tsx, our import statement will…

Sorting An Array of Strings in Typescript and Javascript
| |

Sorting An Array of Strings in Typescript and Javascript

Earlier, we learned how to filter an array in Typescript/Javascript. and now, we will have a quick look over Array.sort() in typescript and javascript. While what we will learn here is simple, it will be the foundation we need for our coming tutorials! Sorting Strings in Javascript / Typescript So we’d have this array: Javascript…

How to filter an array of objects in Typescript, the easy way
|

How to filter an array of objects in Typescript, the easy way

Filtering is something that you would often do in your Javascript and Typescript applications. We’ll be using Array.filter() to achieve this and to make the information more digestible, we will start with a simple array. Filtering an Array of Numbers so let us say we have an array of numbers and we want to filter…