jsx.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Checks if a node represents a DOM element according to React.
  3. * @param {object} node - JSXOpeningElement to check.
  4. * @returns {boolean} Whether or not the node corresponds to a DOM element.
  5. */
  6. export function isDOMComponent(node: object): boolean;
  7. /**
  8. * Test whether a JSXElement is a fragment
  9. * @param {JSXElement} node
  10. * @param {string} reactPragma
  11. * @param {string} fragmentPragma
  12. * @returns {boolean}
  13. */
  14. export function isFragment(node: JSXElement, reactPragma: string, fragmentPragma: string): boolean;
  15. /**
  16. * Checks if a node represents a JSX element or fragment.
  17. * @param {object} node - node to check.
  18. * @returns {boolean} Whether or not the node if a JSX element or fragment.
  19. */
  20. export function isJSX(node: object): boolean;
  21. /**
  22. * Check if node is like `key={...}` as in `<Foo key={...} />`
  23. * @param {ASTNode} node
  24. * @returns {boolean}
  25. */
  26. export function isJSXAttributeKey(node: ASTNode): boolean;
  27. /**
  28. * Check if value has only whitespaces
  29. * @param {unknown} value
  30. * @returns {boolean}
  31. */
  32. export function isWhiteSpaces(value: unknown): boolean;
  33. /**
  34. * Check if the node is returning JSX or null
  35. *
  36. * @param {Context} context The context of `ASTNode`.
  37. * @param {ASTNode} ASTnode The AST node being checked
  38. * @param {boolean} [strict] If true, in a ternary condition the node must return JSX in both cases
  39. * @param {boolean} [ignoreNull] If true, null return values will be ignored
  40. * @returns {boolean} True if the node is returning JSX or null, false if not
  41. */
  42. export function isReturningJSX(context: Context, ASTnode: ASTNode, strict?: boolean, ignoreNull?: boolean): boolean;
  43. /**
  44. * Check if the node is returning only null values
  45. *
  46. * @param {ASTNode} ASTnode The AST node being checked
  47. * @param {Context} context The context of `ASTNode`.
  48. * @returns {boolean} True if the node is returning only null values
  49. */
  50. export function isReturningOnlyNull(ASTnode: ASTNode, context: Context): boolean;
  51. //# sourceMappingURL=jsx.d.ts.map