Skip to content

Commit f98f715

Browse files
authored
refactor: type improvement of useSWRHandler (#4075)
1 parent ee11874 commit f98f715

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index/use-swr.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ export const useSWRHandler = <Data = any, Error = any>(
729729
}
730730
}
731731

732-
return {
732+
const swrResponse: SWRResponse<Data, Error> = {
733733
mutate: boundMutate,
734734
get data() {
735735
stateDependencies.data = true
@@ -747,7 +747,8 @@ export const useSWRHandler = <Data = any, Error = any>(
747747
stateDependencies.isLoading = true
748748
return isLoading
749749
}
750-
} as SWRResponse<Data, Error>
750+
}
751+
return swrResponse
751752
}
752753

753754
export const SWRConfig = OBJECT.defineProperty(ConfigProvider, 'defaultValue', {

0 commit comments

Comments
 (0)