This note demonstrates the way of how to avoid manual types declaration when classes are combined by mixing.

Mixin is a well-known technique which compensates the lack of built-in multiple inheritance in TS/JS. This is partly a workaround, but everything is good enough with typings as long as we adhere functional mixins or sub-class factories patterns. However if we need to merge several unrelated classes (directed acyclic graph, you know), type inference might be slightly complicated for tsc and we have to describe the result type by hand.

The problem can be illustrated by a code snippet from the official…

Anton Golub

JS Enthusiast / System Architect at QIWI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store