Skip to content

Commit

Permalink
fix: add Option generic type
Browse files Browse the repository at this point in the history
  • Loading branch information
toothlessdev committed Nov 21, 2024
1 parent d0a297a commit b96eef5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/forms/FormRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useState } from "react";

import { FormFactory } from "./FormFactory";

export const QuestionTypes = {
Expand All @@ -9,11 +7,16 @@ export const QuestionTypes = {
// doubleSlider: "doubleSlider",
} as const;

export interface Option {
label?: string;
value: string;
}

export interface Question {
questionText: string;
questionType: keyof typeof QuestionTypes;
dataType: string;
options: unknown[];
options: Option[];
}

export interface FormProps {
Expand All @@ -23,8 +26,8 @@ export interface FormProps {
}

export interface FormState {
formState: Record<string, unknown>;
setFormState: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
formState: Record<string, Option[]>;
setFormState: React.Dispatch<React.SetStateAction<Record<string, Option[]>>>;
}

export type FormRendererProps = FormProps & FormState;
Expand Down

0 comments on commit b96eef5

Please sign in to comment.