pub enum Jsx {
React,
ReactJsx,
ReactJsxdev,
ReactNative,
Preserve,
}
Expand description
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§
source§impl<'de> Deserialize<'de> for Jsx
impl<'de> Deserialize<'de> for Jsx
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Jsx
impl StructuralPartialEq for Jsx
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more