Skip to content

Commit

Permalink
fix: be specific with import type
Browse files Browse the repository at this point in the history
  • Loading branch information
thebuilder committed Apr 21, 2022
1 parent 3e129ed commit fa8840f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/InView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { IntersectionObserverProps, PlainChildrenProps } from './index';
import type { IntersectionObserverProps, PlainChildrenProps } from './index';
import { observe } from './observe';

type State = {
Expand Down
2 changes: 1 addition & 1 deletion src/observe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObserverInstanceCallback } from './index';
import type { ObserverInstanceCallback } from './index';

const observerMap = new Map<
string,
Expand Down
2 changes: 1 addition & 1 deletion src/stories/elements.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AnimatePresence, motion } from 'framer-motion';
import React, { useEffect, useRef, useState } from 'react';
import { IntersectionOptions } from '../index';
import type { IntersectionOptions } from '../index';

type ScrollProps = {
children: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/stories/story-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IntersectionOptions } from '../index';
import type { IntersectionOptions } from '../index';

export function getRoot(options: IntersectionOptions) {
if (options.rootMargin && !options.root && window.self !== window.top) {
Expand Down
5 changes: 2 additions & 3 deletions src/useInView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { InViewHookResponse, IntersectionOptions } from './index';
import { useEffect } from 'react';
import type { InViewHookResponse, IntersectionOptions } from './index';
import { observe } from './observe';

type State = {
Expand Down Expand Up @@ -101,7 +100,7 @@ export function useInView({
);

/* eslint-disable-next-line */
useEffect(() => {
React.useEffect(() => {
if (!unobserve.current && state.entry && !triggerOnce && !skip) {
// If we don't have a ref, then reset the state (unless the hook is set to only `triggerOnce` or `skip`)
// This ensures we correctly reflect the current state - If you aren't observing anything, then nothing is inView
Expand Down

0 comments on commit fa8840f

Please sign in to comment.