Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

jsx option should be "preserve" #67

Open
Fredx87 opened this issue Jan 6, 2021 · 0 comments
Open

jsx option should be "preserve" #67

Fredx87 opened this issue Jan 6, 2021 · 0 comments

Comments

@Fredx87
Copy link

Fredx87 commented Jan 6, 2021

In the "Using JSX" section there is this instruction:

Update your tsconfig.json to set "jsx" to "react".

I think that the right value should be "preserve", since the TypeScript documentation says that

The preserve mode will keep the JSX as part of the output to be further consumed by another transform step (e.g. Babel)

If I understand correctly the JSX transformation is not performed by @babel/preset-typescript but by @babel/preset-react, so what is the point to declare a JSX transformation in the tsconfig? Setting preserve can also be useful for supporting the new JSX transform: in the tsconfig we can specify always preserve and let babel decide how to transform the JSX code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant