Typescript does not recognise "index.tsx" as tsx file. All other names work fine.

I have a lot of directories with files called "index.tsx" inside. All worked fine, untill now. files called "index.tsx" don't get typescript syntax highlighting anymore. (other names work fine, as do .ts files) Also it does not get a tsx icon in the project panel. All inspector settings are on default and power save mode is off. Any suggestions? Thanks.

5 comments
Comment actions Permalink

A fix is to assign "index.tsx" to typescript JSX instead of just the wildcard "*.tsx"

0
Comment actions Permalink

Hi there,

>A fix is to assign "index.tsx" to typescript JSX instead of just the wildcard "*.tsx"

That's more like workaround. Better actually fix the issue.

If I'm correct in my assumptions (based on many other similar cases):

  • "Settings/Preferences | Editor | File Types"
  • Locate "Text" file type in top list
  • Find and remove offending pattern in the bottom list (will be "index.tsx" or similar)

 With that in place original "*.tsx" pattern will be enough.

6
Comment actions Permalink

@Andriy your instructions are great!  Apparently IntelliJ thinks my App.tsx is a Tiled Tileset file... which will be why the whole thing is unexpected tokens :P

Thanks.

I guess I need to upgrade to get TSX support in IDEA?

0
Comment actions Permalink

>I guess I need to upgrade to get TSX support in IDEA?

 

What IDEA version do you work with? What kind of problems using TSX have you faced (except for errors caused by wrong type associations)?

0
Comment actions Permalink

Andriy Bazanov  Thanks! Your instructions are brilliant!

I unconsciously assigned the wildcard "*.tsx" to TEXT file type and thought there was something wrong with the LANGUAGES & FRAMEWORKS settings. You made my day :)

0

Please sign in to leave a comment.