Skip to content

compiler crashes with allowJs and dynamic import #28014

@MirKml

Description

@MirKml

TypeScript Version: 3.1.3 2.9.2

Code
tsjs-crash.zip

Minimal example is in the attached zip package. Extract it somewhere, go to main directory with tsconfig.json and

install
npm i
compile
node node_modules/typescript/bin/tsc

Expected behavior:
everything works fine - preferred, because with TS 2.8.x there are no errors,
or some reasonable error message for problem solving

Actual behavior:
compiler crashes with

 E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:69365
                throw e;
                ^
TypeError: Cannot read property 'parent' of undefined
    at Object.getDeclarationOfExpando (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:7328:19)
    at getTypeOfFuncClassEnumModule (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:28883:40)
    at getTypeOfSymbol (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:28984:24)
    at checkImportCallExpression (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:40833:96)
    at checkExpressionWorker (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:42356:32)
    at checkExpression (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:42301:42)
    at checkAwaitExpression (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:41525:31)
    at checkExpressionWorker (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:42383:28)
    at checkExpression (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:42301:42)
    at checkExpressionCached (E:\projects\vscode-crash\node_modules\typescript\lib\tsc.js:42182:38)

Problem is with the imported javascript in TestComponent.tsx with

async exportToXlsx(exportSelected: boolean = false) {
    const xlsx = await import('./js-xlsx/xlsx');
}

Problem is only with Typescript 2.9, 3.x, Typescript 2.8 compiles without any errors.

I tried to exclude javascript with tsconfig.json and jsconfig.json - see exclude properties in these files, but nothing works. Javascript is always compiled. So another question - is it possible exclude javascripts in similar situations?

Metadata

Metadata

Assignees

Labels

CrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions