ref.d.ts 903 B

12345678910111213141516171819
  1. import type * as React from 'react';
  2. export declare const fillRef: <T>(ref: React.Ref<T>, node: T) => void;
  3. /**
  4. * Merge refs into one ref function to support ref passing.
  5. */
  6. export declare const composeRef: <T>(...refs: React.Ref<T>[]) => React.Ref<T>;
  7. export declare const useComposeRef: <T>(...refs: React.Ref<T>[]) => React.Ref<T>;
  8. export declare const supportRef: (nodeOrComponent: any) => boolean;
  9. interface RefAttributes<T> extends React.Attributes {
  10. ref: React.Ref<T>;
  11. }
  12. export declare const supportNodeRef: <T = any>(node: React.ReactNode) => node is React.ReactElement<any, string | React.JSXElementConstructor<any>> & RefAttributes<T>;
  13. /**
  14. * In React 19. `ref` is not a property from node.
  15. * But a property from `props.ref`.
  16. * To check if `props.ref` exist or fallback to `ref`.
  17. */
  18. export declare const getNodeRef: <T = any>(node: React.ReactNode) => React.Ref<T> | null;
  19. export {};