TypeScript best practice guide

1. Introduction TypeScript is not real when compared to the type systems found in languages like C# / Java for example, it has absolutely no power at runtime because it does not exist in the native code we send to the browser, so we must not write development code that skews logical inference as that… Continue reading TypeScript best practice guide

Published
Categorized as Typescript

TypeScript: any vs unknown

Ideally we should never use any, but let’s say we are migrating a legacy project to TypeScript and some degree of pragmatism is in order. Let’s consider this block of code: to get the ball rolling with TypeScript someone probably added an any type here and it seems fairly safe as we never do anything… Continue reading TypeScript: any vs unknown

Published
Categorized as Typescript

Keep your FE dumb!

Try to keep your client as dumb as possible, to achieve this you should avoid the following: In many cases your service layer can take the heavy lift away from the FE which takes away complexity/ risk and avoids duplicating/ mutating business logic + domain sources of truth.

React Hook – asyc request

Think of all the React components that can end up having a useEffect that will call some API which then updates some state to not only hold the value of that but also track request progress, if only there was a way we could abstract some of this away and have dumber components…well consider the… Continue reading React Hook – asyc request