Skip to content

Commit 0991e93

Browse files
Diogo Francothebuilder
authored andcommitted
Update index.d.ts
Fixes incorrect module augmentation declaration, fixes exporting an undefined name.
1 parent f89a0e7 commit 0991e93

File tree

1 file changed

+59
-65
lines changed

1 file changed

+59
-65
lines changed

index.d.ts

Lines changed: 59 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,63 @@
1-
import { RenderProps } from 'react-intersection-observer'
1+
import React = require('react')
22

3-
declare module 'react-intersection-observer' {
4-
import React = require('react')
5-
6-
export interface RenderProps {
7-
inView: boolean
8-
ref: Function
9-
}
10-
11-
export interface IntersectionObserverProps {
12-
/** Children should be either a function or a node */
13-
children?: React.ReactNode | ((inView: boolean) => React.ReactNode)
14-
15-
/** Render prop boolean indicating inView state */
16-
render?: (fields: RenderProps) => React.ReactNode
17-
18-
/**
19-
* The `HTMLElement` that is used as the viewport for checking visibility of
20-
* the target.
21-
* Defaults to the browser viewport if not specified or if `null`.
22-
*/
23-
root?: HTMLElement | null
24-
25-
/**
26-
* Unique identifier for the root element - This is used to identify the
27-
* `IntersectionObserver` instance, so it can be reused.
28-
* If you defined a root element, without adding an `id`, it will create a new
29-
* instance for all components.
30-
*/
31-
rootId?: string
32-
33-
/**
34-
* Margin around the root.
35-
* Can have values similar to the CSS margin property,
36-
* e.g. `"10px 20px 30px 40px"` (top, right, bottom, left).
37-
*/
38-
rootMargin?: string
39-
40-
/**
41-
* Element tag to use for the wrapping component
42-
* @default `'div'`
43-
*/
44-
tag?: string
45-
46-
/** Number between 0 and 1 indicating the the percentage that should be
47-
* visible before triggering. Can also be an array of numbers, to create
48-
* multiple trigger points.
49-
* @default `0`
50-
*/
51-
threshold?: number | number[]
52-
53-
/**
54-
* Only trigger this method once
55-
* @default `false`
56-
*/
57-
triggerOnce?: boolean
58-
59-
/** Call this function whenever the in view state changes */
60-
onChange?: (inView: boolean) => void
61-
}
3+
export interface RenderProps {
4+
inView: boolean
5+
ref: Function
6+
}
627

63-
export default class IntersectionObserver extends React.Component<
64-
IntersectionObserverProps,
65-
{}
66-
> {}
8+
export interface IntersectionObserverProps {
9+
/** Children should be either a function or a node */
10+
children?: React.ReactNode | ((inView: boolean) => React.ReactNode)
11+
12+
/** Render prop boolean indicating inView state */
13+
render?: (fields: RenderProps) => React.ReactNode
14+
15+
/**
16+
* The `HTMLElement` that is used as the viewport for checking visibility of
17+
* the target.
18+
* Defaults to the browser viewport if not specified or if `null`.
19+
*/
20+
root?: HTMLElement | null
21+
22+
/**
23+
* Unique identifier for the root element - This is used to identify the
24+
* `IntersectionObserver` instance, so it can be reused.
25+
* If you defined a root element, without adding an `id`, it will create a new
26+
* instance for all components.
27+
*/
28+
rootId?: string
29+
30+
/**
31+
* Margin around the root.
32+
* Can have values similar to the CSS margin property,
33+
* e.g. `"10px 20px 30px 40px"` (top, right, bottom, left).
34+
*/
35+
rootMargin?: string
36+
37+
/**
38+
* Element tag to use for the wrapping component
39+
* @default `'div'`
40+
*/
41+
tag?: string
42+
43+
/** Number between 0 and 1 indicating the the percentage that should be
44+
* visible before triggering. Can also be an array of numbers, to create
45+
* multiple trigger points.
46+
* @default `0`
47+
*/
48+
threshold?: number | number[]
49+
50+
/**
51+
* Only trigger this method once
52+
* @default `false`
53+
*/
54+
triggerOnce?: boolean
55+
56+
/** Call this function whenever the in view state changes */
57+
onChange?: (inView: boolean) => void
6758
}
6859

69-
export default Component
60+
export default class IntersectionObserver extends React.Component<
61+
IntersectionObserverProps,
62+
{}
63+
> {}

0 commit comments

Comments
 (0)