TSConfig
jsxFragmentFactory
Specify the JSX fragment factory function to use when targeting react JSX emit with jsxFactory compiler option is specified, e.g. Fragment.
For example with this TSConfig:
{"": {"": "esnext","": "commonjs","": "react","": "h","": "Fragment"}}
This TSX file:
tsximport { h, Fragment } from "preact";const HelloWorld = () => (<><div>Hello</div></>);
Would look like:
tsxTryconst preact_1 = require("preact");const HelloWorld = () => ((0, preact_1.h)(preact_1.Fragment, null,(0, preact_1.h)("div", null, "Hello")));
This option can be used on a per-file basis too similar to Babel’s /* @jsxFrag h */ directive.
For example:
tsxTry/** @jsx h *//** @jsxFrag Fragment */import {Cannot find module 'preact' or its corresponding type declarations.2307Cannot find module 'preact' or its corresponding type declarations.h ,Fragment } from"preact" ;constHelloWorld = () => (<><div >Hello</div ></>);