Microsoft/TypeScript

Error: Debug Failure when importing `AssertionError` from `node:assert/strict`

Open

#58,534 opened on 2024年5月14日

GitHub で見る
 (8 comments) (9 reactions) (0 assignees)TypeScript (48,455 stars) (6,726 forks)batch import
BugDomain: Node ESMHelp Wanted

説明

🔎 Search Terms

Error: Debug Failure

🕗 Version & Regression Information

Happened when using tsc v5.4.5 with @types/node. Wasn’t an issue before (older tsc and older @types/node v20.12.12).

⏯ Playground Link

https://github.com/rauschma/tsc-debug-failure

💻 Code

import { AssertionError } from 'node:assert/strict';

Some of my compilerOptions in tsconfig:

"module": "NodeNext",
"moduleResolution": "NodeNext",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"resolveJsonModule": true,

🙁 Actual behavior

Error: Debug Failure.
    at getTypeOfVariableOrParameterOrPropertyWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:53005:11)
    at getTypeOfVariableOrParameterOrProperty (/usr/local/lib/node_modules/typescript/lib/tsc.js:52974:20)
    at getTypeOfSymbol (/usr/local/lib/node_modules/typescript/lib/tsc.js:53306:14)
    at getTypeOfAlias (/usr/local/lib/node_modules/typescript/lib/tsc.js:53226:358)
    at getTypeOfSymbol (/usr/local/lib/node_modules/typescript/lib/tsc.js:53318:14)
    at getNarrowedTypeOfSymbol (/usr/local/lib/node_modules/typescript/lib/tsc.js:67681:18)
    at checkIdentifier (/usr/local/lib/node_modules/typescript/lib/tsc.js:67808:16)
    at checkExpressionWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:76261:16)
    at checkExpression (/usr/local/lib/node_modules/typescript/lib/tsc.js:76216:32)
    at checkNonNullExpression (/usr/local/lib/node_modules/typescript/lib/tsc.js:70497:29)

🙂 Expected behavior

No exception (normal operation)

Additional information about the issue

Possibly helpful:

  • I initially couldn’t tell what the problem was (in my rather large repo) but Nathan Shively-Sanders suggested I change line tsc.js:53005 as follows. That told me that this problem was about AssertionError.
- Debug.assertIsDefined(symbol.valueDeclaration);
+ Debug.assertIsDefined(symbol.valueDeclaration, Debug.formatSymbol(symbol));

コントリビューターガイド

Error: Debug Failure when importing `AssertionError` from `node:assert/strict` · Microsoft/TypeScript#58534 | Good First Issue