title: How can I type this pattern of classes? (Two groups of classes returning types within their own group, with subclasses also returning them)
body: <p>I need four TypeScript classes. Let's call them:</p>
  <ul>
  <li>BlueWhale</li>
  <li>BlueOcean</li>
  <li>OrangeWhale</li>
  <li>OrangeOcean</li>
  </ul>
  <p>All the classes will have some methods returning whales and others returning oceans, but the color of the return type will always match the color of the instance the method was called on. Except for the color of the return type, the methods are identical between both classes of whale and both classes of ocean, so each method should be implemented in only one place.</p>
  <p>All of the classes will be extended, and in the resulting subclasses the methods mentioned above should return instances of the original four classes, not of themselves. (The colors still match.) The solution shouldn't prevent any of the original classes or their subclasses from having their own individual methods.</p>
  <p>For clarity, here are the same requirements in a more verbose form:</p>
  <ul>
  <li>BlueWhale
  <ul>
  <li>some methods return BlueWhale
  <ul>
  <li>their implemention is shared with OrangeWhale methods that return OrangeWhale</li>
  <li>in subclasses, they still return BlueWhale</li>
  </ul>
  </li>
  <li>some methods return BlueOcean
  <ul>
  <li>their implemention is shared with OrangeWhale methods that return OrangeOcean</li>
  <li>in subclasses, they still return BlueOcean</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>BlueOcean
  <ul>
  <li>some methods return BlueOcean
  <ul>
  <li>their implemention is shared with OrangeOcean methods that return OrangeOcean</li>
  <li>in subclasses, they still return BlueOcean</li>
  </ul>
  </li>
  <li>some methods return BlueWhale
  <ul>
  <li>their implemention is shared with OrangeOcean methods that return OrangeWhale</li>
  <li>in subclasses, they still return BlueWhale</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>OrangeWhale
  <ul>
  <li>some methods return OrangeWhale
  <ul>
  <li>their implemention is shared with BlueWhale methods that return BlueWhale</li>
  <li>in subclasses, they still return OrangeWhale</li>
  </ul>
  </li>
  <li>some methods return OrangeOcean
  <ul>
  <li>their implemention is shared with BlueWhale methods that return BlueOcean</li>
  <li>in subclasses, they still return OrangeOcean</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>OrangeOcean
  <ul>
  <li>some methods return OrangeOcean
  <ul>
  <li>their implemention is shared with BlueOcean methods that return BlueOcean</li>
  <li>in subclasses, they still return OrangeOcean</li>
  </ul>
  </li>
  <li>some methods return OrangeWhale
  <ul>
  <li>their implemention is shared with BlueOcean methods that return BlueWhale</li>
  <li>in subclasses, they still return OrangeWhale</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>How would you recommend I type these classes?</p>