Skip to content

EmitResolver cannot handle JsxOpeningLikeElement and JsxOpeningFragment that didn't originate from the parse tree #35686

Open
@itsdouges

Description

@itsdouges

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:

Debug Failure. False expression., typescript transformer, jsx element

Code

  • clone https://github.com/madou/untitled-css-in-js-project
  • run git checkout b229dc749e4614bb8d9194c8de340a82f10c8f8a
  • run yarn
  • run yarn test
  • notice one test fails should not blow up when transforming with const
  • notice a similar test but with var instead of const passes

the 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

const Component = () => <div css={{ fontSize: '20px' }}>hello world</div>;

to

const Component = () => (
<>
  <style>{'.a { font-size: 20px; } '}</style>
  <div className="a">hello world</div>
</>
);

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: TransformsRelates to the public transform APIHelp WantedYou can do thisRescheduledThis issue was previously scheduled to an earlier milestone

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions