react-lazyloading icon indicating copy to clipboard operation
react-lazyloading copied to clipboard

TypeScript support

Open Arrvi opened this issue 3 years ago • 0 comments

Module cannot be used in TypeScript projects unless module declaration is added.

Locally I've created the declaration, but I've got no spare time to create a PR at the moment. Feel free to use it:

declare module 'react-observer-api' {
  export interface UseVisibilityHookOptions {
    root?: HTMLElement;
    threshold?: number;
    rootMargin?: string;
  }

  export const useVisibilityHook: (options?: UseVisibilityHookOptions) => {
    setElement: (ref: React.Ref<React.ReactNode>) => void;
    isVisible: boolean;
    forceVisible: () => void;
    forceCheck: () => void;
  };
}

Arrvi avatar Aug 11 '21 10:08 Arrvi