Here is my input component:
import styled from 'styled-components'
import React, { forwardRef } from 'react'
type Props = {
err: boolean
maxWidth: string
}
export const Input = forwardRef<HTMLInputElement, Props>(({ ...rest }, ref) => {
return <StyledInput {...rest} ref={ref} />
})
const StyledInput = styled.input<Props>``
Here is usage:
<Input name='password' type='password' autoComplete='password' required />
Why name gives me error (as i can see other props have error too):
Type '{ name: string; type: string; autoComplete: string; required: true; }' is not assignable to type 'IntrinsicAttributes & Props & RefAttributes<HTMLInputElement>'.
Property 'name' does not exist on type 'IntrinsicAttributes & Props & RefAttributes<HTMLInputElement>'.ts(2322)
When default react interface has this prop:
interface HTMLInputElement extends HTMLElement {
name: string;
/**
* Gets or sets a string containing a regular expression that the user's input must match.
*/
}