Skip to content

Commit 14b8708

Browse files
authored
allow passing undefined config (#1022)
1 parent dd1bcf9 commit 14b8708

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/use-swr-infinite.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ function useSWRInfinite<Data = any, Error = any>(
2222
...args:
2323
| readonly [KeyLoader<Data>]
2424
| readonly [KeyLoader<Data>, Fetcher<Data>]
25-
| readonly [KeyLoader<Data>, SWRInfiniteConfiguration<Data, Error>]
25+
| readonly [
26+
KeyLoader<Data>,
27+
SWRInfiniteConfiguration<Data, Error> | undefined
28+
]
2629
| readonly [
2730
KeyLoader<Data>,
2831
Fetcher<Data>,
29-
SWRInfiniteConfiguration<Data, Error>
32+
SWRInfiniteConfiguration<Data, Error> | undefined
3033
]
3134
): SWRInfiniteResponse<Data, Error> {
3235
const getKey = args[0]

src/use-swr.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,12 @@ function useSWR<Data = any, Error = any>(
210210
...args:
211211
| readonly [Key]
212212
| readonly [Key, Fetcher<Data> | null]
213-
| readonly [Key, SWRConfiguration<Data, Error>]
214-
| readonly [Key, Fetcher<Data> | null, SWRConfiguration<Data, Error>]
213+
| readonly [Key, SWRConfiguration<Data, Error> | undefined]
214+
| readonly [
215+
Key,
216+
Fetcher<Data> | null,
217+
SWRConfiguration<Data, Error> | undefined
218+
]
215219
): SWRResponse<Data, Error> {
216220
const _key = args[0]
217221
const config = Object.assign(

0 commit comments

Comments
 (0)