Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript support for React 17's new JSX factories #9724

Closed
thetric opened this issue Sep 29, 2020 · 0 comments · Fixed by #9734
Closed

TypeScript support for React 17's new JSX factories #9724

thetric opened this issue Sep 29, 2020 · 0 comments · Fixed by #9734
Milestone

Comments

@thetric
Copy link

thetric commented Sep 29, 2020

Is your proposal related to a problem?

TypeScript 4.1 supports React 17's new JSX factories:

TypeScript 4.1 supports React 17’s upcoming jsx and jsxs factory functions through two new options for the jsx compiler option:

  • react-jsx
  • react-jsxdev

These options are intended for production and development compiles respectively. Often, the options from one can extend from the other. For example, a tsconfig.json for production builds might look like the following:

// ./src/tsconfig.json
{
    "compilerOptions": {
        "module": "esnext",
        "target": "es2015",
        "jsx": "react-jsx",
        "strict": true
    },
    "include": [
        "./**/*"
    ]
}

and one for development builds might look like the following:

// ./src/tsconfig.dev.json
{
    "extends": "./tsconfig.json",
    "compilerOptions": {
        "jsx": "react-jsxdev"
    }
}

Describe the solution you'd like

The default jsx transform in TypeScript should be react-jsxdev. Only when running react-scripts build it should be react-jsx.

Describe alternatives you've considered

Additional context

Related issues:

Background information:

@thetric thetric changed the title TypeScript 4.1 support for React 17's new JSX factories TypeScript support for React 17's new JSX factories Sep 29, 2020
@iansu iansu added this to the 4.0 milestone Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants