Skip to content

Commit c9f9647

Browse files
committed
chore: updated tsd tests to cover FetchData undefined case
1 parent 921cd26 commit c9f9647

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/graphql-hooks/test-d/hooks.test-d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expectType } from 'tsd'
1+
import { expectType, expectError } from 'tsd'
22
import {
33
FetchData,
44
ResetFunction,
@@ -36,6 +36,10 @@ type UseClientRequestReturn = [
3636
expectType<UseClientRequestReturn>(useClientRequest(query))
3737
expectType<UseClientRequestReturn>(useClientRequest(query, clientRequestOptions))
3838

39+
const [fetchData] = useClientRequest(query);
40+
expectType<Promise<UseClientRequestResult<any, object> | undefined>>(fetchData());
41+
expectError<Promise<UseClientRequestResult<any, object>>>(fetchData());
42+
3943
const useQueryOptions: UseQueryOptions = {
4044
ssr: false,
4145
skip: false,

0 commit comments

Comments
 (0)