Skip to content

Commit 47bc86f

Browse files
fix(frontend): type error in useServiceUsageQuery.ts (#6081)
### 💭 Notes Without the change I was getting this error: ```ERROR in ./jsapp/js/account/usage/useServiceUsageQuery.ts:135:3 TS2322: Type 'UseQueryResult<UsageState | undefined, Error>' is not assignable to type 'UseQueryResult<UsageState>'. Type 'QueryObserverRefetchErrorResult<UsageState | undefined, Error>' is not assignable to type 'UseQueryResult<UsageState>'. Type 'QueryObserverRefetchErrorResult<UsageState | undefined, Error>' is not assignable to type 'QueryObserverRefetchErrorResult<UsageState, Error>'. Type 'UsageState | undefined' is not assignable to type 'UsageState'. Type 'undefined' is not assignable to type 'UsageState'. 133 | }, [params?.shouldForceInvalidation]) 134 | > 135 | return useQuery({ | ^^^^^^ 136 | queryKey: [QueryKeys.serviceUsage, organizationData?.id], 137 | queryFn: () => loadUsage(organizationData?.id || null), 138 | // A low stale time is needed to avoid calling the API twice on some situations ``` I remember I was getting the same error after bumping some react-query related dependency. But now I started getting this on `main` without the bump.
1 parent 73f76fe commit 47bc86f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsapp/js/account/usage/useServiceUsageQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ interface ServiceUsageQueryParams {
120120
shouldForceInvalidation?: boolean
121121
}
122122

123-
export const useServiceUsageQuery = (params?: ServiceUsageQueryParams): UseQueryResult<UsageState> => {
123+
export const useServiceUsageQuery = (params?: ServiceUsageQueryParams): UseQueryResult<UsageState | undefined> => {
124124
const { data: organizationData } = useOrganizationQuery()
125125

126126
useEffect(() => {

0 commit comments

Comments
 (0)