Skip to content

Commit 195b6ee

Browse files
committed
Update types to make children optional and only on Fetch component (not useFetch hook)
1 parent 7d8141e commit 195b6ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

index.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ export interface FetchProps<TData = any> {
3838
fetchFunction?: (url: string, options: RequestInit) => Promise<any>;
3939
onDataChange?: (newData: TData, data: TData) => any;
4040
onChange?: (result: FetchResult<TData>) => void;
41-
children: (result: FetchResult<TData>) => React.ReactNode | React.ReactNode;
4241
}
4342

4443
export function useFetch<TData = any>(
4544
props: FetchProps<TData>
4645
): FetchResult<TData>;
4746

4847
export default class Fetch<TData = any> extends React.Component<
49-
FetchProps<TData>
48+
FetchProps<TData> & {
49+
children?: (
50+
result: FetchResult<TData>
51+
) => React.ReactNode | React.ReactNode;
52+
}
5053
> {
5154
// Passing any to FetchResult as unable to use TData
5255
static Consumer: React.Consumer<FetchResult<any>>;

0 commit comments

Comments
 (0)