Skip to content

Make default JSX mode "react" #8529

Open
@donaldpipowitch

Description

@donaldpipowitch

To enable JSX syntax in TypeScript you need two steps:

  • add "jsx": "react" to "compilerOptions" in tsconfig.json
  • use .tsx extension

This is quite troublesome if you want to reuse certain generators/boilerplates/build scripts for us. It is also against the single source of truth principle and can be confusing. I recently stumbled over a bug where we used the .tsx extension, but hadn't configured the tsconfig.json.

There was a lot of discussion recently about changing the .js extension to .mjs to introduce ES6 modules to Node and many people are against that and prefer to have an additional flag in the package.json.
I'd like to see the same for TypeScript and JSX:

  • the .tsx extension is purely optional
  • only "jsx": "react" in tsconfig.json is mandatory

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions