TypeScript Version: 3.7.2
Search Terms:
autocomplete does not exist on type
Code
import React, { Fragment} from 'react';
const User: React.FunctionComponent = () => {
return (
<Fragment>
<form autocomplete="on">
<input autocomplete="off" value="test"/><br/>
</form>
</Fragment>
)
};
export default User;
Failed to compile.
/home/colby/git/mern-backback/client/src/pages/Admin/Users/User/User.tsx
TypeScript error in /home/colby/git/mern-backback/client/src/pages/Admin/Users/User/User.tsx(8,16):
Type '{ autocomplete: string; value: string; }' is not assignable to type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>'.
Property 'autocomplete' does not exist on type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>'. TS2322
6 | <form autocomplete="on">
7 | <input autocomplete="off" value="test"/><br/>
> 8 | </form>
| ^
9 | </Fragment>
10 | )
11 | };
Expected behavior:
to compile correctly
Actual behavior:
Failed to compile.
Related Issues:
<form autocomplete="on">, <input autocomplete="off" />. both have the same issue
as describe at https://www.w3schools.com/tags/att_input_autocomplete.asp
chrome should be able to use this field since 17.0
<form data-autocomplete="off"> works...
that didn't work, this did
declare module 'react' {
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
// extends React's HTMLAttributes
autocomplete?: string;
}
}
ended up being autoComplete="off"
Most helpful comment
ended up being
autoComplete="off"