Skip to content

Commit fa8840f

Browse files
committed
fix: be specific with import type
1 parent 3e129ed commit fa8840f

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/InView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { IntersectionObserverProps, PlainChildrenProps } from './index';
2+
import type { IntersectionObserverProps, PlainChildrenProps } from './index';
33
import { observe } from './observe';
44

55
type State = {

src/observe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ObserverInstanceCallback } from './index';
1+
import type { ObserverInstanceCallback } from './index';
22

33
const observerMap = new Map<
44
string,

src/stories/elements.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AnimatePresence, motion } from 'framer-motion';
22
import React, { useEffect, useRef, useState } from 'react';
3-
import { IntersectionOptions } from '../index';
3+
import type { IntersectionOptions } from '../index';
44

55
type ScrollProps = {
66
children: React.ReactNode;

src/stories/story-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IntersectionOptions } from '../index';
1+
import type { IntersectionOptions } from '../index';
22

33
export function getRoot(options: IntersectionOptions) {
44
if (options.rootMargin && !options.root && window.self !== window.top) {

src/useInView.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
2-
import { InViewHookResponse, IntersectionOptions } from './index';
3-
import { useEffect } from 'react';
2+
import type { InViewHookResponse, IntersectionOptions } from './index';
43
import { observe } from './observe';
54

65
type State = {
@@ -101,7 +100,7 @@ export function useInView({
101100
);
102101

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

0 commit comments

Comments
 (0)