While my code runs smoothly in development mode, I encounter issues when building it for production. Here is the snippet of code:
import React, {KeyboardEvent} from 'react'
interface InputProps{
name: string,
id: string,
placeholder: string,
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
}
const Input = (props: InputProps) => {
const {name, id, placeholder, onKeyDown} = props
return (
<input name={name} id={id} placeholder={placeholder} onKeyDown={onKeyDown} type="text" className="bg-gray-50 border border-gray-400 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" required/>
)
}
export default Input
The error message states:
Type error: Type 'OmitWithTag<InputProps, keyof PageProps, "default">' does not satisfy the constraint '{ [x: string]: never; }'.
Property 'name' is incompatible with index signature.
Type 'string' is not assignable to type 'never'.
I had anticipated that my code would function properly in a production environment.