Enum tsconfig::Jsx[][src]

pub enum Jsx {
    React,
    ReactJsx,
    ReactJsxdev,
    ReactNative,
    Preserve,
}

Controls how JSX constructs are emitted in JavaScript files. This only affects output of JS files that started in .tsx files.

For example, this sample code:

export const helloWorld = () => <h1>Hello world</h1>;

Default: “react”

export const helloWorld = () => React.createElement("h1", null, "Hello world");

Preserve: “preserve”

export const helloWorld = () => <h1>Hello world</h1>;

React Native: “react-native”

export const helloWorld = () => <h1>Hello world</h1>;

React 17 transform: “react-jsx”

import { jsx as _jsx } from "react/jsx-runtime";
export const helloWorld = () => _jsx("h1", { children: "Hello world" }, void 0);

React 17 dev transform: “react-jsxdev”

import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
const _jsxFileName = "/home/runner/work/TypeScript-Website/TypeScript-Website/packages/typescriptlang-org/index.tsx";
export const helloWorld = () => _jsxDEV("h1", { children: "Hello world" }, void 0, false, { fileName: _jsxFileName, lineNumber: 7, columnNumber: 32 }, this);

Variants

React

Emit .js files with JSX changed to the equivalent React.createElement calls

ReactJsx

Emit .js files with the JSX changed to _jsx calls

ReactJsxdev

Emit .js files with the JSX to _jsx calls

ReactNative

Emit .js files with the JSX unchanged

Preserve

Emit .jsx files with the JSX unchanged

Trait Implementations

impl Clone for Jsx[src]

impl Copy for Jsx[src]

impl Debug for Jsx[src]

impl<'de> Deserialize<'de> for Jsx[src]

impl PartialEq<Jsx> for Jsx[src]

impl StructuralPartialEq for Jsx[src]

Auto Trait Implementations

impl RefUnwindSafe for Jsx

impl Send for Jsx

impl Sync for Jsx

impl Unpin for Jsx

impl UnwindSafe for Jsx

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.