Skip to content

"Debug Failure. Unexpected node." with --allowjs over transpiled enums #36098

Closed
@filipesilva

Description

@filipesilva

TypeScript Version: 3.7.4

Search Terms:
allowjs
Debug Failure. Unexpected node.
Code

Note: in case it's relevant this js code is transpiled from TS. Having the comment and the import seem to be an integral part of the repro. I assume this is related to the allowJs changes in 3.7.

// repro.js
import { share } from 'rxjs/operators';
/** @enum {number} */
const ChangeDetectionStrategy = {
  OnPush: 0,
  Default: 1,
};
ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = 'OnPush';
ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = 'Default';
kamik@RED-X1C6 MINGW64 /d/sandbox/ts-issue-XYZ-allow-js-debug-failure (master)
$ yarn tsc --allowJs --outFile out.js repro.js
yarn run v1.21.1
$ D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\.bin\tsc --allowJs --outFile out.js repro.js
D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:78593
                throw e;
                ^

Error: Debug Failure. Unexpected node.
Node 75 was unexpected.
    at getDeclarationSpaces (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:49632:41)
    at checkExportsOnMergedDeclarations (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:49566:
41)
    at checkVariableLikeDeclaration (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:50567:17) 
    at checkVariableDeclaration (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:50604:20)     
    at checkSourceElementWorker (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:52654:28)     
    at checkSourceElement (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:52511:17)
    at Object.forEach (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:116:30)
    at checkVariableStatement (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:50613:16)       
    at checkSourceElementWorker (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:52623:28)     
    at checkSourceElement (D:\sandbox\ts-issue-XYZ-allow-js-debug-failure\node_modules\typescript\lib\tsc.js:52511:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior:
No Debug Failure. Unexpected node. error.
Actual behavior:
Errored out in a weird way.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions