Code Monkey home page Code Monkey logo

Comments (6)

fatcerberus avatar fatcerberus commented on June 23, 2024

It makes TSX more generic for use by any library, and less React specific

But... you specifically asked for react-jsx...

from typescript.

dawidgarus avatar dawidgarus commented on June 23, 2024

It makes TSX more generic for use by any library, and less React specific

But... you specifically asked for react-jsx...

If react-jsx is to be used only with react, then why don't we have "jsxImportSource" hardcoded to "react"? Or in other words, the ONLY way to use tsx for anything other than react is to set "jsx" to "preserve", because only "preserve" doesn't have the word react in it. Is that the official stance of TypeScript?

from typescript.

Josh-Cena avatar Josh-Cena commented on June 23, 2024

react-jsx means "compile JSX syntax using React semantics" so yes if your JSX flavor is non-React-compatible you would use preserve.

from typescript.

nmain avatar nmain commented on June 23, 2024

tsx for anything other than react

View frameworks exist that are not React, not React-compatible, but still are compatible only in the jsx function.

There's also the react preset for Typescript, which transforms to a function call (usually named React.createElement or h) with slightly different children semantics, and has no special semantics for key.

from typescript.

RyanCavanaugh avatar RyanCavanaugh commented on June 23, 2024

We don't do type-directed emit, which is what this is asking for.

jsx: react doesn't have the key special-casing; it's more accurately thought of as the JSX semantics of ~2016 that predate _jsx

jsx: react-jsx really does include React-specific semantics

jsx: preserve exists if neither of those work for your scenario

from typescript.

typescript-bot avatar typescript-bot commented on June 23, 2024

This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

from typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.