Skip to content

Incorrect export causes assertion failure in declaration emitter #4506

Closed
@weswigham

Description

@weswigham
if (false) {
  export var myClass = 0;
}
export type MyClass = typeof myClass;

Trying to compile this with "declaration" on causes tsc to fatally error out with a Debug Failure (I've noticed the language service hangs on this file, yet to investigate why but I assume it's the same reason), after reporting the (correct) error

 error TS1184: Modifiers cannot appear here.

Specifically, we get

Error: Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 190

SyntaxKind 190 refers to the Block kind. Looking at isDeclarationVisible, this is likely because it has an export flag, so it tries to check its parent's visibility (the block) and errors since it doesn't have a branch to handle Block.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions