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.
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 […]
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.
As of TypeScript 3.1, the lib.es5.d.ts file provides a couple of predefined types that are very helpful when trying to write generic higher-order functions. In this post, I’m going to show an example of using the Parameters and ReturnType predefined types for just that purpose.
Every application needs to handle a couple of tasks: loading initial data for users and determining what page or screen they land on. Despite being order-dependent, this logic is often scattered into various parts of the application. This can lead to subtle bugs and makes it hard to answer simple questions like, “What will the […]
I’m currently working in TypeScript after spending a lot of time in F#, and I’ve been experimenting with adapting my favored functional approaches to the former.
The project I’m working on has a Node.js back end written in TypeScript, with a PostgreSQL database for persistence. We had a production user who encountered an error when the system tried to insert a row into a table that had an integer column in it. The value it was trying to insert was 239.99999999999997, […]
A while ago, I was working on a project based off the Atomic SPA Starter Kit, which uses TypeScript, React, and GraphQL. One of the features we needed to build was a file upload component that supported dragging and dropping a file from a separate window onto the UI.
When developing software, it’s always tough to work with caching. While my team appreciates the efficiencies that Data Loader can provide for applications, we still struggle with the same problems that always come up when caching queries, mainly invalidating caches when a data set has changed.