title: Typescript: deep keyof of a nested object
body: <p>So I would like to find a way to have all the keys of a nested object. </p>
  
  <p>I have a generic type that take a type in parameter. My goal is to get all the keys of the given type.</p>
  
  <p>The following code work well in this case. But when I start using a nested object it's different.</p>
  
  <pre class="lang-js prettyprint-override"><code>type SimpleObjectType = {
    a: string;
    b: string;
  };
  
  // works well for a simple object
  type MyGenericType&lt;T extends object&gt; = {
    keys: Array&lt;keyof T&gt;;
  };
  
  const test: MyGenericType&lt;SimpleObjectType&gt; = {
    keys: ['a'];
  }
  </code></pre>
  
  <p>Here is what I want to achieve but it doesn't work.</p>
  
  <pre class="lang-js prettyprint-override"><code>type NestedObjectType = {
    a: string;
    b: string;
    nest: {
      c: string;
    };
    otherNest: {
      c: string;
    };
  };
  
  type MyGenericType&lt;T extends object&gt; = {
    keys: Array&lt;keyof T&gt;;
  };
  
  // won't works =&gt; Type 'string' is not assignable to type 'a' | 'b' | 'nest' | 'otherNest'
  const test: MyGenericType&lt;NestedObjectType&gt; = {
    keys: ['a', 'nest.c'];
  }
  </code></pre>
  
  <p>So what can I do, without using function, to be able to give this kind of keys to <code>test</code> ?</p>