title: Error in optional prop-types check in typescript
body: <p>I'm writing react typescript and have problem with <strong>optional</strong> prop-types check. Below is my code:</p>
  <pre><code>import PropTypes from 'prop-types';
  
  interface InputNumberProps {
    className?: string | string[];
  }  
  
  export const InputNumberAutosize = (props: InputNumberProps, ref: refType) =&gt; {  
     ...
  }
  
  const InputNumberAutoSizeComponent = React.forwardRef(InputNumberAutosize);
  
  InputNumberAutoSizeComponent.propTypes = {
    className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
  };
  </code></pre>
  <p>Somehow my typescript throw error in className when declare like this.
  Here is the error:</p>
  <pre><code>TS2322: Type 'Requireable&lt;string | (string | null | undefined)[]&gt;' is not assignable to type 'Validator&lt;string | string[] | null | undefined&gt;'.    
     
  Types of property '[nominalTypeHack]' are incompatible. 
  
  Type '{ type: string | (string | null | undefined)[] | null | undefined; } | undefined' is not assignable to type '{ type: string | string[] | null | undefined; } | undefined'.     
  
  Type '{ type: string | (string | null | undefined)[] | null | undefined; }' is not assignable to type '{ type: string | string[] | null | undefined; }'.       
  
  Types of property 'type' are incompatible.        
  
  Type 'string | (string | null | undefined)[] | null | undefined' is not assignable to type 'string | string[] | null | undefined'.          
  
  Type '(string | null | undefined)[]' is not assignable to type 'string | string[] | null | undefined'.               
  
  Type '(string | null | undefined)[]' is not assignable to type 'string[]'.   
  
  Type 'string | null | undefined' is not assignable to type 'string'.       
  
  Type 'undefined' is not assignable to type 'string'.
  </code></pre>
  <p>This looks weird because as I read in the documents, the <code>prop-types</code> should be <strong>optional</strong> and accept <code>undefined</code>. Anyone know how to fix this, thanks.</p>
  <p><strong>Update</strong>: I think the problem come from <strong>PropTypes.arrayOf(PropTypes.string)</strong>. The <strong>arrayOf</strong> cause the error.</p>
  <p>My <code>tsconfig.json</code></p>
  <pre><code>{
      &quot;compilerOptions&quot;: {
          &quot;allowSyntheticDefaultImports&quot;: true,
          &quot;module&quot;: &quot;commonjs&quot;,
          &quot;target&quot;: &quot;es5&quot;,
          &quot;lib&quot;: [&quot;es2015&quot;, &quot;dom&quot;],
          &quot;types&quot;: [&quot;node&quot;, &quot;jest&quot;],
          &quot;jsx&quot;: &quot;react&quot;,
          &quot;moduleResolution&quot;: &quot;node&quot;,
          &quot;sourceMap&quot;: true,
          &quot;allowJs&quot;: false,
          &quot;strict&quot;: true,
          &quot;declaration&quot;: true,
          &quot;esModuleInterop&quot;: true
      },
      &quot;exclude&quot;: [&quot;src/**/__tests__/**&quot;]
  }
  </code></pre>
  <p><strong>Typescript version :</strong> <code>&quot;typescript&quot;: &quot;^3.4.2&quot;</code></p>