title: TypeScript : Generic type with primitive types constrain
body: <p>I have the following generic classes in TypeScript</p>
  <pre><code>type UserId = number
  type Primitive = string | number | boolean
  class ColumnValue&lt;T, S extends Primitive&gt; {
      constructor(public columnName: String, public value: S) { }
  }
  abstract class Column&lt;T&gt; {
      constructor(public columnName: String) { }
      public set&lt;S extends Primitive&gt;(value: T): ColumnValue&lt;T, S&gt; {
          return new ColumnValue(this.columnName, this.getValue(value))
      }
      public abstract getValue&lt;S extends Primitive&gt;(value: T): S
  }
  let id = new class extends Column&lt;UserId&gt; {
      constructor() { super(&quot;id&quot;) }
      public getValue(value: UserId): number {
          return value
      }
  }()
  </code></pre>
  <p>But I don't know why get this error:</p>
  <pre class="lang-none prettyprint-override"><code>Class '(Anonymous class)' incorrectly extends base class 'Column&lt;number&gt;'.
    Types of property 'getValue' are incompatible.
      Type '(value: number) =&gt; number' is not assignable to type '&lt;S extends Primitive&gt;(value: number) =&gt; S'.
        Type 'number' is not assignable to type 'S'
  </code></pre>