Skip to content

adding typescript 5 option "verbatimModuleSyntax": true in tsconfig causes crashΒ #53302

@mlippert

Description

@mlippert

Bug Report

πŸ”Ž Search Terms

  • verbatimModuleSyntax

πŸ•— Version & Regression Information

  • This is a crash using the new verbatimModuleSyntax option in typescript version 5.0.2

⏯ Playground Link

This doesn't seem code related, it seems related to the compiler options

πŸ’» Code

tsconfig.json

{
    "extends": "@tsconfig/node18-strictest-esm/tsconfig.json",
    "compilerOptions": {
        "outDir": "dist",
        "module": "node16",
        "moduleResolution": "node16",
        "moduleDetection": "force",
        "allowSyntheticDefaultImports": true,
        "resolveJsonModule": false,
        "declaration": true,
        "pretty": true,
        "newLine": "lf",
        "removeComments": true,
        "noEmitOnError": true,
        "useDefineForClassFields": true,
        "noImplicitThis": true,
        "noImplicitAny": true,
        "strictNullChecks": true,
        "exactOptionalPropertyTypes": false,
        "verbatimModuleSyntax": true,
        "ignoreDeprecations": "5.0" // TODO: when node18-strictest-esm is updated for typescript 5 remove this
    },
    "include": ["src"],
    "exclude": ["node_modules", "dist"]
}

πŸ™ Actual behavior

> tsc

/Projects/mysql-query/node_modules/typescript/lib/tsc.js:113959
      throw e;
      ^

Error: Debug Failure. False expression.
    at isReferencedAliasDeclaration (/Projects/mysql-query/node_modules/typescript/lib/tsc.js:80348:11)
    at canConvertImportDeclarationToTypeOnly (/Projects/mysql-query/node_modules/typescript/lib/tsc.js:78887:175)
    at checkImportsForTypeOnlyConversion (Projects/mysql-query/node_modules/typescript/lib/tsc.js:78902:11)
    at checkSourceFileWorker (/Projects/mysql-query/node_modules/typescript/lib/tsc.js:79465:9)
    at checkSourceFile (//Projects/mysql-query/node_modules/typescript/lib/tsc.js:79413:5)
    at checkSourceFileWithEagerDiagnostics (/Projects/mysql-query/node_modules/typescript/lib/tsc.js:79507:5)
    at getDiagnosticsWorker (/Projects/mysql-query/node_modules/typescript/lib/tsc.js:79515:7)
    at Object.getDiagnostics (/ /Projects/mysql-query/node_modules/typescript/lib/tsc.js:79492:14)
    at / /Projects/mysql-query/node_modules/typescript/lib/tsc.js:113984:76
    at runWithCancellationToken (/Projects/mysql-query/node_modules/typescript/lib/tsc.js:113954:14)

Node.js v18.15.0`

Note that if I set "verbatimModuleSyntax": false it doesn't crash. The build runs.

πŸ™‚ Expected behavior

A clean build or an error message about what is incompatible with setting "verbatimModuleSyntax": true.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions