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:
@@ -6,6 +6,7 @@ interface TextFieldMD3Props {
|
||||
error?: FieldError;
|
||||
registration: UseFormRegisterReturn;
|
||||
type?: 'text' | 'password';
|
||||
placeholder?: string;
|
||||
helpText?: string;
|
||||
helpTextPrefix?: React.ReactNode;
|
||||
required?: boolean;
|
||||
@@ -18,6 +19,7 @@ export function TextFieldMD3({
|
||||
error,
|
||||
registration,
|
||||
type = 'text',
|
||||
placeholder,
|
||||
helpText,
|
||||
helpTextPrefix,
|
||||
required,
|
||||
@@ -29,7 +31,7 @@ export function TextFieldMD3({
|
||||
<input
|
||||
id={id}
|
||||
type={type}
|
||||
placeholder=" "
|
||||
placeholder={placeholder || " "}
|
||||
className={[
|
||||
'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',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ function buildZodSchema(backendType: BackendType): z.ZodObject<Record<string, z.
|
||||
? z.string().min(1, `${field.label} is required`)
|
||||
: z.string();
|
||||
|
||||
if (field.validate) {
|
||||
if ('validate' in field && field.validate) {
|
||||
schema = (schema as z.ZodString).regex(field.validate.regex, field.validate.message);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user