abracadabra: "Convert to Pure Component" won't parse tsx

I’m getting errors when trying to use the extension like: image

in both cases, what’s happening is the extension is trying to parse a .tsx file as javascript, and therefore erroring when it sees something that isn’t valid jsx (like a type definition, or the keyword interface).

I’m assuming this is because it’s not picking up the correct configuration to give to babel. is there a way I can explicitly pass in some babel configuration options so the extension can parse the code correctly? Or is there a specific place I need to put a babel config file?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

My end goal is to get a refactor that will extract a TSX component for me, and generate types. Gonna start having a play this week - will let you know if I get anywhere.

Makes sense! - I’ll try the things you suggest tomorrow if I get time, but I’m likely to need some help getting to the bottom of this I suspect. I’ll update if I get anywhere

sorry, could you check out the pure component refactor issue? I think maybe we had a race condition on github posts just then!

Thanks for the details and the example repo @paprikati, I’ll have a look at that.

It’s curious indeed because the extension should definitely be able to parse TSX code. But there’s probably something weird going on and I’ll find it 🕵️