toString<T>(stringOrToString: (string | ((_: T) => string)))
Define the toString method on an object's prototype.
This allows a custom string representation to be provided for data objects,
which is excellent for debugging - similar to Rust's Debug and Display.
Replace string with a function that takes object to get dynamic
behavior (i.e. complete parity with Display/Debug).
Also an example of how to do mixins in JavaScript without using classes.
Mixins are a very useful pattern from languages with multiple inheritance. They make OOP quite tolerable in e.g. Python.
Making TypeScript correctly recognize these left as exercise to reader.
stringOrToString: (string | ((_: T) => string))