If I have a component,
import { FC } from 'react';
interface Props {
name: string;
}
const Home: FC<Props> = ({ name, ...rest }) => {
return (
<>
<div>{name}</div>
<input {...rest} type="text" />
</>
);
};
export default Home;
and try to use it like <Home name="testName" placeholder="test" />, my editor is mad giving red underline under placeholder.
Raw Error:
Type '{ name: string; placeholder: string; }' is not assignable to type 'IntrinsicAttributes & Props & { children?: ReactNode; }'.
Property 'placeholder' does not exist on type 'IntrinsicAttributes & Props & { children?: ReactNode; }'.
I tried extending the Props with HTMLAttributes but it didn't work.
interface Props extends HTMLAttributes<HTMLElement> {
name: string;
}
