Skip to content

TypeScript support #16

Description

@Arrvi

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;
  };
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions