-
Notifications
You must be signed in to change notification settings - Fork 12.8k
"Debug Failure. False expression." when using default export from js file #60692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The playground can be set to Javascript, and does seem to get the same error: https://www.typescriptlang.org/play/?filetype=js#code/KYDwDg9gTgLgBAE2AMwIYFcA28DuBLAOwQhwG4AoIA
|
via bisect, I've determined the problem was introduced in #59282 and is likely in |
OK, I lied, I got closer. The switch in TypeScript/src/compiler/utilities.ts Lines 3604 to 3609 in 476e9ee
Given: export default baz where |
I'm wondering if there will be a fix for this or should I start looking to change my own code to try to solve this? I am unable to upgrade because of this |
Personally, I did a workaround. It's pretty simple since it works as long as you set the value before you export it
|
Error occurred any time a TSX file was edited. Related to microsoft/TypeScript#60692. TypeScript doesn't like exports of globals, even in JS files it shouldn't be checking anyway.
I had to patch the package in order to skip this check so that my bundler can work. It's not a good idea, though. diff --git a/lib/typescript.js b/lib/typescript.js
index dc0fe9a56bb4d9b08efe8b5948a60a74a4e9997b..3949bd42b5d2f120c1f1521de685164884ed1d7a 100755
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -55006,7 +55006,7 @@ function createTypeChecker(host) {
},
isOptionalParameter,
isUndefinedIdentifierExpression(node) {
- Debug.assert(isExpressionNode(node));
+ // Debug.assert(isExpressionNode(node)); // To get rid of: [!] (plugin typescript) Error: Debug Failure. False expression.
return getSymbolAtLocation(node) === undefinedSymbol;
},
isEntityNameVisible(context, entityName, shouldComputeAliasToMakeVisible) {
|
I'm getting the exact same error in my code. Also began in TS 5.7 |
π Search Terms
debug failure false expression export default composite allowjs js
π Version & Regression Information
β― Playground Link
https://stackblitz.com/edit/ts-false-expression-tqxlxy?file=tsconfig.json,package.json
π» Code
The error also seems to happen if you replace
console
with anything fromglobalThis
(screen, scroll, fetch, etc.)TSConfig.json:
π Actual behavior
Running tsc results in this error:
π 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:
The text was updated successfully, but these errors were encountered: