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.

2 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.

2

Please sign in to leave a comment.