title: React-Typescript: How do I type a default prop?
body: <p>Let's say I have this component class:</p>
  
  <pre><code>interface SomeComponentProps {
    someOptionalProperty?: string;
  }
  interface SomeComponentState { /* ... */ }
  
  class SomeComponent extends React.Component&lt;SomeComponentProps, SomeComponentState&gt; {
    static defaultProps = {
      someOptionalProp = 'some default value',
    }
  
    method() {
      const shouldNotBeOptional = this.props.someOptionalProp;
    }
  }
  </code></pre>
  
  <p>How can I assert that <code>this.props.someOptionalProp</code> is not undefined within the class but is also optional when trying to using the component?</p>
  
  <p>What I've been doing is just ignoring <code>defaultProps</code> altogether by creating getters that</p>
  
  <pre><code>return `this.props.someOptionalProp || 'the default value'`;
  </code></pre>
  
  <p>but I'd like to use <code>defaultProps</code> because my team uses it.</p>