File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,10 @@ export interface SWRHook {
231
231
key : SWRKey ,
232
232
fetcher : Fetcher < Data , SWRKey > | null
233
233
) : SWRResponse < Data , Error >
234
+ < Data = any , Error = any , SWRKey extends Key = Key > (
235
+ key : SWRKey ,
236
+ fetcher : Fetcher < Data , SWRKey > | null
237
+ ) : SWRResponse < Data , Error >
234
238
<
235
239
Data = any ,
236
240
Error = any ,
@@ -259,10 +263,6 @@ export interface SWRHook {
259
263
config : SWROptions
260
264
) : SWRResponse < Data , Error , SWROptions >
261
265
< Data = any , Error = any > ( key : Key ) : SWRResponse < Data , Error >
262
- < Data = any , Error = any > (
263
- key : Key ,
264
- fetcher : BareFetcher < Data > | null
265
- ) : SWRResponse < Data , Error >
266
266
<
267
267
Data = any ,
268
268
Error = any ,
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import type { Equal } from '@type-challenges/utils'
6
6
export function useDataErrorGeneric ( ) {
7
7
useSWR < { id : number } > ( '/api/' , ( ) => ( { id : 123 } ) )
8
8
useSWR < string , any > ( '/api/' , ( key : string ) => key )
9
+ const fetcher = ( { url } : { url : string } ) => url
10
+ useSWR ( { url : '/api' } , fetcher )
9
11
useSWRInfinite < string [ ] , any > (
10
12
( index , previousPageData ) => {
11
13
expectType < Equal < number , typeof index > > ( true )
You can’t perform that action at this time.
0 commit comments