Skip to content

Commit b89b121

Browse files
committed
Create FormFieldValues type
1 parent a3038b6 commit b89b121

File tree

1 file changed

+5
-3
lines changed
  • packages/chakra-components/src/components/Election/Questions

1 file changed

+5
-3
lines changed

packages/chakra-components/src/components/Election/Questions/Form.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import { useConfirm } from '../../layout'
77
import { QuestionsConfirmation } from './Confirmation'
88
import { ElectionStateStorage, RenderWith, SubElectionState, SubmitFormValidation } from './Questions'
99

10+
export type FormFieldValues = Record<string, FieldValues>
11+
1012
export type QuestionsFormContextState = {
11-
fmethods: UseFormReturn<any>
13+
fmethods: UseFormReturn<FormFieldValues>
1214
} & SpecificFormProviderProps &
1315
ReturnType<typeof useMultiElectionsProvider>
1416

@@ -35,7 +37,7 @@ export type SpecificFormProviderProps = {
3537
export const QuestionsFormProvider: React.FC<
3638
PropsWithChildren<QuestionsFormProviderProps & SpecificFormProviderProps>
3739
> = ({ children, ...props }) => {
38-
const fmethods = useForm()
40+
const fmethods = useForm<FormFieldValues>()
3941
const multiElections = useMultiElectionsProvider({ fmethods, ...props })
4042

4143
return (
@@ -85,7 +87,7 @@ export const constructVoteBallot = (election: PublishedElection, choices: FieldV
8587
const useMultiElectionsProvider = ({
8688
fmethods,
8789
confirmContents,
88-
}: { fmethods: UseFormReturn } & QuestionsFormProviderProps) => {
90+
}: { fmethods: UseFormReturn<FormFieldValues> } & QuestionsFormProviderProps) => {
8991
const { confirm } = useConfirm()
9092
const { client, isAbleToVote: rootIsAbleToVote, voted: rootVoted, election, vote } = useElection() // Root Election
9193
// State to store on memory the loaded elections to pass it into confirm modal to show the info

0 commit comments

Comments
 (0)