title: How to extract inner property's type from a possibly undefined type
body: <p>I have the following type</p>
  <pre><code>type User = { user?: { subscription?: {...} | null | undefined, ... } | null | undefined };
  </code></pre>
  <p>I want to get the type of <code>subscription</code>, i.e. I want to do something like</p>
  <pre><code>type SubscriptionType = User['user']['subscription'];
  </code></pre>
  <p>but TS Server throws the following error and the type of SubscriptionType is set to <code>any</code></p>
  <pre><code>typescript: Property 'subscription' does not exist on type '{ __typename?: &quot;users&quot; | undefined; subscription?: { __typename?: &quot;subscriptions&quot; | undefined; id: number; activeSince?: any; renewalDate?: any; endingDate?: any; ... 7 more ...; } | null | undefined; } | null | undefined'.
  </code></pre>
  <p>I cannot define this type myself as it's being generated by graphql codegen and would change whenever the graphql query changes.</p>