Microsoft/TypeScript
View on GitHubError: Debug Failure when importing `AssertionError` from `node:assert/strict`
Open
#58,534 opened on May 14, 2024
BugDomain: Node ESMHelp Wanted
Description
🔎 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:53005as follows. That told me that this problem was aboutAssertionError.
- Debug.assertIsDefined(symbol.valueDeclaration);
+ Debug.assertIsDefined(symbol.valueDeclaration, Debug.formatSymbol(symbol));