title: How to fix Typescript error "Object is possibly 'undefined'"
body: <p>I'm building a cloud function that will use the Stripe API to process payments. This is within a firebase project. When I run <code>firebase deploy</code> I get the error "Object is possible 'undefined'" <code>const existingSource = customer.sources.data.filter( (s) =&gt; s.id === source).pop();</code>
  I'm not sure how to resolve this.</p>
  
  <p>Here is my xxx.ts where getorCreateCustomer exists</p>
  
  <pre><code>/** Read the stripe customer ID from firestore, or create a new one if missing */
  export const getOrCreateCustomer = async(uid: string) =&gt; {
      const user = await getUser(uid); 
      const customerId = user &amp;&amp; user.stripeCustomerId; 
  
      //if missing customerId, create it
      if (!customerId) {
          return createCustomer(uid); 
      }
      else {
          return stripe.customers.retrieve(customerId); 
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/u3qk9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u3qk9.png" alt="enter image description here"></a></p>