Skip to content

Commit 1bc73d3

Browse files
committed
fix: make the generic param optional
1 parent 59fbe96 commit 1bc73d3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import type {
55
} from 'compute-scroll-into-view'
66

77
/** @public */
8-
export type Options<T> = StandardBehaviorOptions | CustomBehaviorOptions<T>
8+
export type Options<T = unknown> =
9+
| StandardBehaviorOptions
10+
| CustomBehaviorOptions<T>
911

1012
/** @public */
1113
export interface StandardBehaviorOptions extends BaseOptions {
@@ -16,7 +18,7 @@ export interface StandardBehaviorOptions extends BaseOptions {
1618
}
1719

1820
/** @public */
19-
export interface CustomBehaviorOptions<T> extends BaseOptions {
21+
export interface CustomBehaviorOptions<T = unknown> extends BaseOptions {
2022
behavior: CustomScrollBehaviorCallback<T>
2123
}
2224

@@ -30,7 +32,7 @@ let isStandardScrollBehavior = (
3032
): options is StandardBehaviorOptions =>
3133
options === Object(options) && Object.keys(options).length !== 0
3234

33-
let isCustomScrollBehavior = <T>(
35+
let isCustomScrollBehavior = <T = unknown>(
3436
options: any
3537
): options is CustomBehaviorOptions<T> =>
3638
typeof options === 'object' ? typeof options.behavior === 'function' : false
@@ -64,7 +66,7 @@ export default function scrollIntoView(
6466
options?: StandardBehaviorOptions | boolean
6567
): void
6668
/** @public */
67-
export default function scrollIntoView<T>(
69+
export default function scrollIntoView<T = unknown>(
6870
target: Element,
6971
options?: StandardBehaviorOptions | CustomBehaviorOptions<T> | boolean
7072
): T | void {

0 commit comments

Comments
 (0)