title: TypeScript: Dynamicaly change returned object properties to required
body: <p>Suppose I have a function that returns this:</p>
  <pre class="lang-js prettyprint-override"><code>interface result {
    A?: string;
    B?: string;
    C?: string;
  }
  </code></pre>
  <p>Using an array parameter of a function, How can I make some of my return parameter not-null and required? Something like this:</p>
  <pre class="lang-js prettyprint-override"><code>function toRequired(keysToTurnRequired: string[]): CorrectResult {
  }
  </code></pre>
  <p>If i run for example <code>toRequired(['A', 'B'])</code> then my return type should be this:</p>
  <pre><code>result {
    A!: string;
    B!: string;
    C?: string;
  }
  </code></pre>
  <p>Is there any generic way to achieve this in Typescript? It is super useful to achieve type safety when joining relations form ORM repositories.</p>