<p dir="auto">I'm fairly sure this is unrelated to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="113146378" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/5389" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/5389/hovercard" href="https://github.com/microsoft/TypeScript/issues/5389">#5389</a></p>
<p dir="auto">Returning a non-Promise custom type from an async function causes the compiler to crash.</p>
<p dir="auto">Given this tsconfig</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;compilerOptions&quot;: {
        &quot;experimentalAsyncFunctions&quot;: true,
        &quot;target&quot;: &quot;ES6&quot;
    }
}"><pre class="notranslate">{
    <span class="pl-ent">"compilerOptions"</span>: {
        <span class="pl-ent">"experimentalAsyncFunctions"</span>: <span class="pl-c1">true</span>,
        <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>ES6<span class="pl-pds">"</span></span>
    }
}</pre></div>
<p dir="auto">and this code</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="type SomeType = {
    someValue: string
}

async function someFunction(): SomeType {
    return {
        someValue: ''
    }
}"><pre class="notranslate"><span class="pl-k">type</span> <span class="pl-smi">SomeType</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someValue</span>: <span class="pl-smi">string</span>
<span class="pl-kos">}</span>

<span class="pl-k">async</span> <span class="pl-k">function</span> <span class="pl-en">someFunction</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">SomeType</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">{</span>
        <span class="pl-c1">someValue</span>: <span class="pl-s">''</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">tsc will crash with the following</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot read property 'flags' of undefined
    at isKnownProperty (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:14041:25)
    at hasExcessProperties (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:14063:26)
    at isRelatedTo (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:13955:25)
    at checkTypeRelatedTo (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:13903:26)
    at checkTypeAssignableTo (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:13886:20)
    at checkReturnStatement (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:19460:29)
    at checkSourceElement (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:20461:28)
    at Object.forEach (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:90:30)
    at checkBlock (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:18973:16)
    at checkSourceElement (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:20440:28)"><pre class="notranslate"><code class="notranslate">TypeError: Cannot read property 'flags' of undefined
    at isKnownProperty (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:14041:25)
    at hasExcessProperties (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:14063:26)
    at isRelatedTo (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:13955:25)
    at checkTypeRelatedTo (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:13903:26)
    at checkTypeAssignableTo (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:13886:20)
    at checkReturnStatement (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:19460:29)
    at checkSourceElement (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:20461:28)
    at Object.forEach (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:90:30)
    at checkBlock (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:18973:16)
    at checkSourceElement (/Users/andrewsmith/.nvm/versions/node/v0.12.6/lib/node_modules/typescript/lib/tsc.js:20440:28)
</code></pre></div>
<p dir="auto">tsc -v returns <code class="notranslate">message TS6029: Version 1.6.2</code></p>
<p dir="auto">/usr/local/lib/node_modules/typescript/lib/tsc.js:29825</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="async function abc():number{
    return 123;
}"><pre class="notranslate"><code class="notranslate">async function abc():number{
    return 123;
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/usr/local/lib/node_modules/typescript/lib/tsc.js:29825
                throw e;
                      ^
TypeError: Cannot read property 'flags' of undefined
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:13951:56)"><pre class="notranslate"><code class="notranslate">/usr/local/lib/node_modules/typescript/lib/tsc.js:29825
                throw e;
                      ^
TypeError: Cannot read property 'flags' of undefined
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:13951:56)
</code></pre></div>