Open
Description
To enable JSX syntax in TypeScript you need two steps:
- add
"jsx": "react"
to"compilerOptions"
intsconfig.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"
intsconfig.json
is mandatory