Most applications with user accounts will need to do permission checking. Of course, it’s important to include all of the appropriate testing to ensure that only users with the correct permissions can perform certain actions. But what if we also had a way to explicitly tell anyone making calls to restricted functions that a particular […]
Both GraphQL and TypeScript support the concept of discriminated unions (also known as tagged unions). In this post, I’ll walk through setting up an example GraphQL schema and the corresponding TypeScript types, along with writing a query to retrieve a union type.
For the last few years, we’ve been using a universal TypeScript platform including TypeScript, GraphQL, React, and Express. Having TypeScript on both the client and the server (including command-line utilities and background worker processes) has transformed how we go about ensuring the quality of the software we build. When compared to other stacks we’ve used, […]
Over the last year and a half, I’ve had the pleasure of working on a web app built in TypeScript. I came to Atomic with no web development experience at all. On my first couple of projects, I spent most of my time working on small, relatively isolated pieces of functionality for various applications: a […]
TypeScript 2.8 introduced the conditional type operator, which allows for building comprehensive and powerful types. One of the more useful ones I’ve found is a “disjoint” type, which ensures that there are no elements in common between two sets or objects. This could also be referred to as “mutual exclusion.”
TypeScript is a wonderful language for designing data-driven applications. The type system is suited to describe the many different shapes and transformations of data as it travels from one end of a system to another. As my team has gained more experience with TypeScript, we’ve developed some guidelines for creating typed modules that help the […]
Great apps aren’t stuck in the mud. They change with the times. They float like oak leaves along a wide river of user expectations, business requirements, fashion trends, and platform changes. To keep floating, leaves 🍂 apps need a watchful team of developers to walk the muddy banks nudging them back toward fast water whenever […]
In my last post, I showed how to write a higher-order function that could wrap an existing function without losing the original function’s types. Today, I’m going to show how you can use that same technique to wrap an existing function for a different result–to execute it in a background process using the workerpool npm […]
On a recent project, we needed to support multi-level tab bar navigation within our application. With multiple variations of tab bars, each page needed to know which tabs to show. We found that TypeScript offered a good solution.
Being explicit about the return type of the function is the most under-utilized feature of TypeScript. At least, that’s true for the way I write my code. When I first started using TypeScript, I was really impressed with the way it inferred the return type of the function, and having these types perpetuate throughout the […]