React TS – Property 'onBlur' does not exist on type 'IntrinsicAttributes & InputProps & RefAttributes<HTMLInputElement>'

The issue here is that the `onBlur` event is not defined in your `InputProps` interface. You can add `onBlur` to the `InputProps` interface to resolve the TypeScript error.

Here’s how you can update your `InputProps` interface:

export interface InputProps {
defaultValue?: string;
disabled?: boolean;
info?: string | string[];
name?: string;
onChange?: (e?: ChangeEvent) => void;
onBlur?: (e: FocusEvent) => void; // Add onBlur to the interface
placeholder?: string;
readOnly?: boolean;
required?: boolean;
status?: 'error' | 'info' | 'warning';
type?: string;
}

By adding `onBlur` to the `InputProps` interface, the TypeScript error should be resolved. Now, you can use the `onBlur` event in your `Input` component as well as in the component usage without any TypeScript errors.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *