fix: resolve remaining TypeScript compilation errors

- Add placeholder property to TextFieldMD3 component and props interface
- Fix vite.config.ts to import defineConfig from vitest/config instead of vite
- Add type guard for validate property in schemas/index.ts to handle readonly array union types
- Remove unused StepIndicatorWithDispatch placeholder function from tests

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 17:37:47 +02:00
co-authored by Claude Haiku 4.5
parent c04b149756
commit 0dae30b4e2
4 changed files with 5 additions and 8 deletions
+3 -1
View File
@@ -6,6 +6,7 @@ interface TextFieldMD3Props {
error?: FieldError; error?: FieldError;
registration: UseFormRegisterReturn; registration: UseFormRegisterReturn;
type?: 'text' | 'password'; type?: 'text' | 'password';
placeholder?: string;
helpText?: string; helpText?: string;
helpTextPrefix?: React.ReactNode; helpTextPrefix?: React.ReactNode;
required?: boolean; required?: boolean;
@@ -18,6 +19,7 @@ export function TextFieldMD3({
error, error,
registration, registration,
type = 'text', type = 'text',
placeholder,
helpText, helpText,
helpTextPrefix, helpTextPrefix,
required, required,
@@ -29,7 +31,7 @@ export function TextFieldMD3({
<input <input
id={id} id={id}
type={type} type={type}
placeholder=" " placeholder={placeholder || " "}
className={[ className={[
'peer w-full rounded-md border bg-transparent px-3 pb-2 pt-5 text-sm text-on-surface', 'peer w-full rounded-md border bg-transparent px-3 pb-2 pt-5 text-sm text-on-surface',
'placeholder-transparent focus:outline-none focus:ring-2', 'placeholder-transparent focus:outline-none focus:ring-2',
@@ -163,8 +163,3 @@ describe('StepIndicator', () => {
}); });
}); });
}); });
// Placeholder type for the spy component — not actually used in tests
function StepIndicatorWithDispatch(_props: { dispatch: (action: { type: string; payload?: unknown }) => void }) {
return null;
}
+1 -1
View File
@@ -15,7 +15,7 @@ function buildZodSchema(backendType: BackendType): z.ZodObject<Record<string, z.
? z.string().min(1, `${field.label} is required`) ? z.string().min(1, `${field.label} is required`)
: z.string(); : z.string();
if (field.validate) { if ('validate' in field && field.validate) {
schema = (schema as z.ZodString).regex(field.validate.regex, field.validate.message); schema = (schema as z.ZodString).regex(field.validate.regex, field.validate.message);
} }
+1 -1
View File
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';