eslint-codemod-utils
Version:
A collection of AST helper functions for more complex ESLint rule fixes.
16 lines (15 loc) • 821 B
TypeScript
import { TSESTree as ESTree } from '..';
import type { Loose, StringableASTNode } from '../types';
/**
* A `jsx(…)` runtime-style factory. Accepts a `type` (string or function
* component) plus props/children and returns a `StringableASTNode<JSXElement>`.
*
* `children` are typed as `JsxChild` so that both raw string/number text and
* nested `jsx()` results can be passed through uniformly.
*/
type JsxProps = Record<string, unknown> & {
children?: JsxChild | JsxChild[];
};
type JsxChild = StringableASTNode<ESTree.JSXElement> | Loose<ESTree.JSXChild> | string | number | false | null | undefined;
export declare const jsx: (type: string | ((...args: any[]) => StringableASTNode<ESTree.JSXElement>), props: JsxProps, ...children: JsxChild[]) => StringableASTNode<ESTree.JSXElement> | undefined;
export {};