title: Type 'undefined' is not assignable to type 'never'
body: <pre class="lang-js prettyprint-override"><code>interface A {
    name?: string
    age: number
  }
  
  var a: A = {
    name: '',
    age: 23
  }
  
  var result:A = (Object.keys(a) as Array&lt;keyof A&gt;).reduce((prev, key) =&gt; {
    if (a[key] || a[key] === 0) {
      prev[key] = a[key] // this reported a error about `Type 'undefined' is not assignable to type 'never'`
    }
    return prev
  }, {} as A)
  
  console.log(JSON.stringify(result))
  </code></pre>
  
  <p>above is reproduce code.</p>
  
  <p>I found that the code works under typescript@~3.4.0,but does not compileunder typescript@^3.5.0, and I checked the update log between 3.4 and 3.5,but I did not find any references about this.</p>
  
  <p>So I guess if it is because <code>index signature</code> is not set, then:</p>
  
  <pre><code>interface A {
    name?: string
    age: number
    [K:string]:any &lt;-- add this line
  }
  
  var a: A = {
    name: '',
    age: 23
  }
  
  var result:A = (Object.keys(a) as Array&lt;keyof A&gt;).reduce((prev, key/* validation lost */) =&gt; {
    if (a[key] || a[key] === 0) {
      prev[key] = a[key]
    }
    return prev
  }, {} as A)
  
  console.log(JSON.stringify(result))
  </code></pre>
  
  <p>The previous error disappeared, but the type of <code>key</code> that was the parameter in the <code>reduce</code> callback became <code>string|number</code>, causing the type validation of the key to be lost.</p>
  
  <p>Is this the normal behavior?</p>
  
  <p>if yes, I wonder that how to solve <code>Type 'undefined' is not assignable to type 'never'</code>,and keep the type check for the <code>key</code>.</p>