title: How to resolve - Argument of type is not assignable to type - TYPESCRIPT
body: <p>I have a function, that takes among other things an object of functions:</p>
  <pre><code>type ForMembers&lt;S&gt; = {
   [Key: string]: (arg: S) =&gt; void;
  };
  
  export default function transform&lt;S extends { [index: string]: any }, D extends { [index: string]: any }&gt;(
    source: S,
    interfaceName: string,
    forMembers?: ForMembers&lt;S&gt;
  ): D {
    const newObj = extract(source, getKeys(interfaceName));
    if (forMembers) {
      Object.keys(forMembers).forEach((key) =&gt; forMembers[key](newObj));
    }
    return newObj as unknown as D;
  }
  </code></pre>
  <p>The idea is that i can pass any object of functions that i want, but typescript for some reason requires  that i pass all the properties that exist on type , otherwise it throws an error</p>
  <p>For instance if D is</p>
  <pre><code>interface Destination {
  name: string;
  bio: string;
  names: string[];
  profession: {
    field: string;
    level: string;
    };
  </code></pre>
  <p>And i call the function as:</p>
  <pre><code>transform&lt;Source, Destination&gt;(sourceData, &quot;Destination&quot;, {
    name: () =&gt; {},
    bio: () =&gt; {},
    profession: () =&gt; {},
  });
  }
  </code></pre>
  <p>It will throw an error:</p>
  <blockquote>
  <p>Argument of type '{ name: () =&gt; void; bio: () =&gt; void; profession: () =&gt; void; }' is not assignable to parameter of type 'ForMembers&lt;Destination, Source&gt;'.
  Property 'names' is missing in type '{ name: () =&gt; void; bio: () =&gt; void; profession: () =&gt; void; }' but required in type 'ForMembers&lt;Destination, Source&gt;'.</p>
  </blockquote>
  <p>If i add the missing property - 'names', the error goes away, however i want to pass only the properties i need, not all of them. So the question is this - How to make the function to take as forMembers any combination of properties of D, not necessarily all of them?</p>