Skip to content

Commit

Permalink
actually correct typing now
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Nov 22, 2024
1 parent e271ae8 commit 91ed2a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion api-client/src/runs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ export interface UpdateErrorRecoveryPolicyRequest {
data: ErrorRecoveryPolicy
}

export type ErrorRecoveryPolicyResponse = UpdateErrorRecoveryPolicyRequest
export type UpdateErrorRecoveryPolicyResponse = Record<string, never>
export type ErrorRecoveryPolicyResponse = ErrorRecoveryPolicy

/**
* Current Run State Data
Expand Down
6 changes: 3 additions & 3 deletions app/src/resources/runs/useUpdateRecoveryPolicyWithStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { getErrorRecoveryPolicy } from '@opentrons/api-client'

import type {
HostConfig,
ErrorRecoveryPolicyResponse,
RecoveryPolicyRulesParams,
UpdateErrorRecoveryPolicyResponse,
} from '@opentrons/api-client'

/**
Expand All @@ -26,7 +26,7 @@ export function useUpdateRecoveryPolicyWithStrategy(
): (
newPolicy: UpdateErrorRecoveryPolicyWithStrategy['newPolicy'],
strategy: UpdateErrorRecoveryPolicyWithStrategy['strategy']
) => Promise<ErrorRecoveryPolicyResponse> {
) => Promise<UpdateErrorRecoveryPolicyResponse> {
const host = useHost()

const {
Expand All @@ -38,7 +38,7 @@ export function useUpdateRecoveryPolicyWithStrategy(
strategy: UpdateErrorRecoveryPolicyWithStrategy['strategy']
) =>
getErrorRecoveryPolicy(host as HostConfig, runId).then(res => {
const existingPolicyRules = res.data.data.policyRules.map(rule => ({
const existingPolicyRules = res.data.policyRules.map(rule => ({
commandType: rule.matchCriteria.command.commandType,
errorType: rule.matchCriteria.command.error.errorType,
ifMatch: rule.ifMatch,
Expand Down
10 changes: 5 additions & 5 deletions react-api-client/src/runs/useUpdateErrorRecoveryPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ import type {
import type { AxiosError } from 'axios'
import type {
RecoveryPolicyRulesParams,
ErrorRecoveryPolicyResponse,
UpdateErrorRecoveryPolicyResponse,
HostConfig,
} from '@opentrons/api-client'

export type UseErrorRecoveryPolicyResponse = UseMutationResult<
ErrorRecoveryPolicyResponse,
UpdateErrorRecoveryPolicyResponse,
AxiosError,
RecoveryPolicyRulesParams
> & {
updateErrorRecoveryPolicy: UseMutateFunction<
ErrorRecoveryPolicyResponse,
UpdateErrorRecoveryPolicyResponse,
AxiosError,
RecoveryPolicyRulesParams
>
}

export type UseUpdateErrorRecoveryPolicyOptions = UseMutationOptions<
ErrorRecoveryPolicyResponse,
UpdateErrorRecoveryPolicyResponse,
AxiosError,
RecoveryPolicyRulesParams
>
Expand All @@ -41,7 +41,7 @@ export function useUpdateErrorRecoveryPolicy(
const host = useHost()

const mutation = useMutation<
ErrorRecoveryPolicyResponse,
UpdateErrorRecoveryPolicyResponse,
AxiosError,
RecoveryPolicyRulesParams
>(
Expand Down

0 comments on commit 91ed2a5

Please sign in to comment.