title: Is there "operator overloading" in ES6 / TypeScript? (or how to make object invokable)
body: <p>I've been away from JS development for some time and wonder if there is something like this in modern JavaScript or TypeScript?</p>
  
  <p>C++</p>
  
  <pre><code>struct Functor {
      double operator()(double value) { ... }
  </code></pre>
  
  <p>Kotlin:</p>
  
  <pre><code>class Whatever {
      operator fun invoke(value: Double): Double { ... }
  </code></pre>
  
  <p>In ES5 it was possible to do:</p>
  
  <pre><code>var interpolator = function (value) {
      var t = (value - domainStart) / domainDelta
      return (1 - t) * rangeStart + t * rangeEnd;
  }
  interpolator.invert = function () { ... }
  interpolator.setDomain = function (a, b) { ... }
  interpolator.setRange = function (a, b) { ... }
  
  // and then use like so
  interpolator.setDomain(0, 1)
  interpolator.setRange(50, 200)
  let rangeValue = interpolator(0.5) // 125
  </code></pre>