Closed
Description
π Search Terms
debug failure false expression export default composite allowjs js
π Version & Regression Information
- This changed between versions 5.6.2 and 5.7.2
β― Playground Link
https://stackblitz.com/edit/ts-false-expression-tqxlxy?file=tsconfig.json,package.json
π» Code
// In a JS file
export default console;
The error also seems to happen if you replace console
with anything from globalThis
(screen, scroll, fetch, etc.)
TSConfig.json:
"composite": true,
"allowJs": true,
π Actual behavior
Running tsc results in this error:
> tsc
Error: Debug Failure. False expression.
at Object.isUndefinedIdentifierExpression (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:50211:15)
at typeFromExpression (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:132377:22)
at serializeTypeOfExpression (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:132107:20)
at Object.serializeTypeOfDeclaration (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:132131:16)
at serializeTypeForDeclaration (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:52640:41)
at serializeMaybeAliasAssignment (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:54015:19)
at serializeAsAlias (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:53899:13)
at serializeSymbolWorker (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:53255:11)
at serializeSymbol (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:53119:11)
at eval (/home/projects/ts-false-expression-tqxlxy/node_modules/typescript/lib/_tsc.js:53089:11)
Node.js v18.20.3
π Expected behavior
No Error :-)
Additional information about the issue
I see this both locally and in stackblitz. I don't know how to reproduce in the playground because it only seems to happen when using a JS file.
This does not cause an error:
const thing = console;
export default thing;