Adding a second middleware broke our typescript types
Summary
The article analyzes a TypeScript typings bug in Inngest's SDK when stacking two middleware. It explains how the Jsonify type interacts with optional properties, causing a corrupted JsonifyObject<{}> on double application, and walks through root causes, attempted fixes, and a robust solution. It also highlights testing pitfalls and practical takeaways for library authors.