jsx-classic.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import type {Child, Properties, Result} from './create-h.js'
  2. /**
  3. * This unique symbol is declared to specify the key on which JSX children are
  4. * passed, without conflicting with the `Attributes` type.
  5. */
  6. declare const children: unique symbol
  7. /**
  8. * Define the return value of JSX syntax.
  9. */
  10. export type Element = Result
  11. /**
  12. * Key of this interface defines as what prop children are passed.
  13. */
  14. export interface ElementChildrenAttribute {
  15. /**
  16. * Only the key matters, not the value.
  17. */
  18. [children]?: never
  19. }
  20. /**
  21. * Disallow the use of functional components.
  22. */
  23. export type IntrinsicAttributes = never
  24. /**
  25. * Define the prop types for known elements.
  26. *
  27. * For `hastscript` this defines any string may be used in combination with
  28. * `hast` `Properties`.
  29. *
  30. * This **must** be an interface.
  31. */
  32. export type IntrinsicElements = Record<
  33. string,
  34. | Properties
  35. | {
  36. /**
  37. * The prop that matches `ElementChildrenAttribute` key defines the
  38. * type of JSX children, defines the children type.
  39. */
  40. [children]?: Child
  41. }
  42. >