Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript support #16

Open
Arrvi opened this issue Aug 11, 2021 · 0 comments
Open

TypeScript support #16

Arrvi opened this issue Aug 11, 2021 · 0 comments

Comments

@Arrvi
Copy link

Arrvi commented Aug 11, 2021

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;
  };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant