Skip to content

Commit

Permalink
allow passing undefined config (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Mar 10, 2021
1 parent dd1bcf9 commit 14b8708
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/use-swr-infinite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ function useSWRInfinite<Data = any, Error = any>(
...args:
| readonly [KeyLoader<Data>]
| readonly [KeyLoader<Data>, Fetcher<Data>]
| readonly [KeyLoader<Data>, SWRInfiniteConfiguration<Data, Error>]
| readonly [
KeyLoader<Data>,
SWRInfiniteConfiguration<Data, Error> | undefined
]
| readonly [
KeyLoader<Data>,
Fetcher<Data>,
SWRInfiniteConfiguration<Data, Error>
SWRInfiniteConfiguration<Data, Error> | undefined
]
): SWRInfiniteResponse<Data, Error> {
const getKey = args[0]
Expand Down
8 changes: 6 additions & 2 deletions src/use-swr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ function useSWR<Data = any, Error = any>(
...args:
| readonly [Key]
| readonly [Key, Fetcher<Data> | null]
| readonly [Key, SWRConfiguration<Data, Error>]
| readonly [Key, Fetcher<Data> | null, SWRConfiguration<Data, Error>]
| readonly [Key, SWRConfiguration<Data, Error> | undefined]
| readonly [
Key,
Fetcher<Data> | null,
SWRConfiguration<Data, Error> | undefined
]
): SWRResponse<Data, Error> {
const _key = args[0]
const config = Object.assign(
Expand Down

0 comments on commit 14b8708

Please sign in to comment.