In this article we’ll cover a basic Effects As Types example; using types in TypeScript to represent side-effects. We do this to help ensure our code works, leveraging the compiler for fast feedback, and simplifying our unit tests. By the end you’ll understand how you can leverage the compiler to assert important side-effects happen instead of using spies.
I’ve seen this negative incentive at a much smaller level at a few companies of various sizes. It was what I was talking about a couple weeks ago about reading how Google is tackling it with maintenance motivated incentives from leadership.
When I started on an Angular team, I got really irritated about all the as any / as Partial<T> for all the mocks/stubs the various teams were using in tests. I’ve learned over the years to assume empathy, but this rubbed me the wrong way.