Flavoring: Flexible Nominal Typing for TypeScript

Recently, we’ve been making heavy use of TypeScript at Atomic Object. We love the great tooling and instant feedback we get with the language’s powerful type system. TypeScript’s structural type system gives us a lot of powerful tools for making invalid states unrepresentable, thereby pointing out bugs at compile time instead of runtime.

However, one challenge we’ve faced with TypeScript in applying this approach is how to differentiate between values that have the same shape, but mean very different things. For example, if both my Person and my BlogPost have a numeric ID, I’d really like to communicate to TypeScript that they’re not interchangeable. But a function that takes a number accepts both kinds of values.

This post will examine the challenges one might face using the usual approach to this modeling problem, and how we’ve side-stepped them with a variation on the usual technique.
Read more on Flavoring: Flexible Nominal Typing for TypeScript…

A New Redux Action Pattern for TypeScript 2.4+

In September 2016, I wrote a post about a pattern for strongly typed Redux reducers in TypeScript. Since then, the TypeScript team has been busy enhancing the language, and recent changes in TypeScript have enabled a much more natural, boilerplate-free pattern for strongly typed actions and reducers in TypeScript.
Read more on A New Redux Action Pattern for TypeScript 2.4+…

Modular, Type-safe Metadata with TypeScript

One of the humps I’ve encountered while learning TypeScript is coming to terms with a core tenet of the language—the type definitions you write only exist at compile time, not at runtime.

I’ve bumped into this a few times. Can I generate a predicate function to test for type compatibility? No—use type guards instead. Can I reflect on the properties of a type at runtime? No—with caveats. It turns out that those caveats matter a lot, and you can do some pretty powerful things with the tools TypeScript does provide. Read more on Modular, Type-safe Metadata with TypeScript…

Immutable.js Records in TypeScript

React apps with Redux are built around an immutable state model. Your entire application state is one immutable data structure stored in a single variable. Changes in your application are not made by mutating fields on model objects or controllers, but by deriving new versions of your application state when you make a single change to the previous version.

This approach comes with some huge benefits in tooling and simplicity, but it requires some care.
Read more on Immutable.js Records in TypeScript…

When Should a Startup Hire a Software Consultant?

Atomic Object works with all sorts of companies, from technical startups to established traditional businesses to Fortune 500 companies. We engage each company differently, trying to structure the engagement to best meet the needs of the client.

Startups, in particular, have a number of cost/benefit questions to consider before engaging a consultancy like ours. Depending on the situation, working with a consultancy can be a smart move or a bad fit. Read more on When Should a Startup Hire a Software Consultant?…