title: Typescript > Generics > Union Constraint
body: <p>Why does the typescript compiler throw the following error:</p>
  
  <p><code>Operator '+' cannot be applied to types 'T' and 'T'.</code>,</p>
  
  <p>when compiling:</p>
  
  <pre class="lang-js prettyprint-override"><code>export const addNumbersOrCombineStrings = &lt;T extends string | number&gt;(
    param1: T,
    param2: T
  ): T =&gt; param1 + param2
  </code></pre>
  
  <p>?</p>