-
Notifications
You must be signed in to change notification settings - Fork 515
Open
Labels
typescriptRelated to TypeScript implementationRelated to TypeScript implementation
Description
Inertia adapter(s) affected
- React
- Vue 3
- Svelte
- Not Applicable
JS package version
2.0.17
Backend stack (optional)
"php": "^8.2",
"inertiajs/inertia-laravel": "^2.0",
"intervention/image": "^3.11",
"laravel/framework": "^12.0",
"dependencies": {
"@inertiajs/react": "^2.0.17",
Describe the problem
interface ClientForm {
first_name: string;
last_name: string;
email: string;
password: string;
password_confirmation: string;
[key: string]: any;
}
const { data, setData, errors, post, reset, processing } = useForm<ClientForm>({
email: '',
first_name: '',
last_name: '',
password: '',
password_confirmation: '',
});
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {
const { name, value, type } = e.target as HTMLInputElement;
setData(name, value);
};
Error here
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)
const name: string
setData(name, value);
<form onSubmit={handleSubmit} className="space-y-4">
<div className="grid w-full gap-4 md:grid-cols-2 lg:grid-cols-2">
<div className="col-span-1 flex flex-col space-y-2">
<Label htmlFor="first_name">First Name</Label>
<Input
id="first_name"
name="first_name"
type="text"
required
tabIndex={1}
autoComplete="first_name"
value={data.first_name}
onChange={handleChange}
disabled={processing}
placeholder="Enter client first name"
/>
{errors.first_name && <span className="text-destructive">{errors.first_name}</span>}
</div>
Error here
Property 'first_name' does not exist on type 'Partial<Record<never, string>>'.ts(2339)
errors.first_name
Steps to reproduce
I was working fine as soon i update npm this errors showing in whole project
Metadata
Metadata
Assignees
Labels
typescriptRelated to TypeScript implementationRelated to TypeScript implementation