A deep dive into a tricky TypeScript compile-time error — 'Argument of type interface is not assignable to parameter of type interface' — encountered while refactoring NgRx to support variadic tuple types. The post explains the conditions that trigger the error (generics with callback arguments returning the same generic type), shows why TypeScript fails to infer the type correctly, and presents the fix: using a mapped type with `keyof` to help TypeScript infer the generic more loosely. The solution was contributed by Alex Okrushko to NgRx without breaking the public API.

3m read timeFrom timdeschryver.dev
Post cover image
1 Impression