Skip to content

Transpiling an asynchronous generator causes an internal compiler exception #4144

Closed
@weswigham

Description

@weswigham

Attempting to ts.transpile this async generator

async function*(f) { yield f; }

throws

TypeError: Cannot read property 'members' of undefined
    at resolveDeclaredMembers (D:\repos\TypeScript\built\local\typescript.js:15456:65)
    at resolveTypeReferenceMembers (D:\repos\TypeScript\built\local\typescript.js:15486:26)
    at resolveStructuredTypeMembers (D:\repos\TypeScript\built\local\typescript.js:15705:21)
    at getPropertiesOfObjectType (D:\repos\TypeScript\built\local\typescript.js:15713:24)
    at propertiesRelatedTo (D:\repos\TypeScript\built\local\typescript.js:17272:34)
    at objectTypeRelatedTo (D:\repos\TypeScript\built\local\typescript.js:17238:30)
    at isRelatedTo (D:\repos\TypeScript\built\local\typescript.js:17062:34)
    at checkTypeRelatedTo (D:\repos\TypeScript\built\local\typescript.js:16929:26)
    at checkTypeAssignableTo (D:\repos\TypeScript\built\local\typescript.js:16902:20)
    at isTypeAssignableTo (D:\repos\TypeScript\built\local\typescript.js:16896:20)

annotating the generator return value in any way causes the exception to not be thrown. This also only happens when the async generator is anonymous.

I know that async generators aren't technically valid JS, but attempting to transpile one probably shouldn't throw.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDuplicateAn existing issue was already createdFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions