Skip to content

const {} = require import causes Debug Failure #39373

Closed
@sahithyandev

Description

@sahithyandev

TypeScript Version: 3.8.3, 4.0.0-dev.20200701 (tested on both versions)

Search Terms: typescrpt importing problem (Error. Debug Failure.)

Code

// H is a exported class in a file called test.ts in the same directory.

// when using this line, the error is shown
const { H } = require('./test');

// when using this line, the error is gone
// import { H } from './test';

Expected behavior: When running tsc -b, tsc builds the project.

Actual behavior: tsc -b returns an error.

$ tsc -b
/usr/share/nodejs/typescript/lib/tsc.js:81040
                throw e;
                ^

Error: Debug Failure.
    at Object.assertDefined (/usr/share/nodejs/typescript/lib/tsc.js:1724:24)
    at /usr/share/nodejs/typescript/lib/tsc.js:13692:89
    at String.replace (<anonymous>)
    at formatStringFromArgs (/usr/share/nodejs/typescript/lib/tsc.js:13692:21)
    at createFileDiagnostic (/usr/share/nodejs/typescript/lib/tsc.js:13712:20)
    at createDiagnosticForNodeInSourceFile (/usr/share/nodejs/typescript/lib/tsc.js:10181:16)
    at Object.createDiagnosticForNode (/usr/share/nodejs/typescript/lib/tsc.js:10171:16)
    at handleSymbolAccessibilityError (/usr/share/nodejs/typescript/lib/tsc.js:73879:50)
    at checkEntityNameVisibility (/usr/share/nodejs/typescript/lib/tsc.js:74252:13)
    at visitDeclarationSubtree (/usr/share/nodejs/typescript/lib/tsc.js:74389:29)

Playground Link: This is a problem related to importing. I don't know where can I do that.

Related Issues: I didn't find any related issues

To Reproduce: Clone this repo to reproduce

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions