Closed
Description
I'm fairly sure this is unrelated to #5389
Returning a non-Promise custom type from an async function causes the compiler to crash.
Given this tsconfig
{
"compilerOptions": {
"experimentalAsyncFunctions": true,
"target": "ES6"
}
}
and this code
type SomeType = {
someValue: string
}
async function someFunction(): SomeType {
return {
someValue: ''
}
}
tsc will crash with the following
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)
tsc -v returns message TS6029: Version 1.6.2