-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
EmitResolver cannot handle JsxOpeningLikeElement and JsxOpeningFragment that didn't originate from the parse tree #35686
Comments
hi is @rbuckton going to be working on this? if not is there any pointers you can give me to fix this? 😄 |
TL;DR: - ts.createJsxOpeningElement(ts.createIdentifier('style'), [], ts.createJsxAttributes([])), node,
+ ts.setOriginalNode(ts.createJsxOpeningElement(ts.createIdentifier('style'), [], ts.createJsxAttributes([])), node),
- ts.createJsxOpeningFragment(),
+ ts.setOriginalNode(ts.createJsxOpeningFragment(), node), The issue title should rather be: "EmitResolver cannot handle JsxOpeningLikeElement and JsxOpeningFragment that didn't originate from the parse tree" Explanation: I looked into this. The es2015 transform tries to generate a unique name for block-scoped bindings if it has the same name as another binding in the same function scope. If there is any block scoped binding in the file, it tries to look up every Identifier to detect potential collisions. Since Unfortunately there's the JSX transform transforming your JSX Elements to JSX-factory calls. This code ( |
hi @ajafff really appreciate you looking into this - thanks! with this new knowledge for replacing nodes - how would you recommend replacing a node in a typescript transformer the proper way? (let's say I want to change a function declaration to an arrow function) is i've been writing up this handbook https://github.com/madou/typescript-transformer-handbook - would love to have all pro tips and how to's etc in it. if you have time to give it a proof read would be great 😄 fix applied, works great thanks mate |
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
Debug Failure. False expression., typescript transformer, jsx element
Code
https://github.com/madou/untitled-css-in-js-project
git checkout b229dc749e4614bb8d9194c8de340a82f10c8f8a
yarn
yarn test
should not blow up when transforming with const
var
instead ofconst
passesthe node transformation is done here - if i return the original jsx element node then the test passes. but then that defeats the purpose of the transformer.. 😛
the code is essentially transforming
to
Expected behavior:
it works no error thrown
Actual behavior:
"Debug Failure. False expression."
error thrown. also tried with nightly typescript version - same error.Related Issues:
#24380
😄 would love to get this figured out! hoping it's just something i've done wrong. make from this twitter thread https://twitter.com/orta/status/1206139333448732672
The text was updated successfully, but these errors were encountered: