Typescript: Property 'autocomplete' does not exist on type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>'.

Created on 16 Aug 2020  路  3Comments  路  Source: microsoft/TypeScript

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

Most helpful comment

ended up being autoComplete="off"

All 3 comments

<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"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wmaurer picture wmaurer  路  3Comments

blendsdk picture blendsdk  路  3Comments

jbondc picture jbondc  路  3Comments

kyasbal-1994 picture kyasbal-1994  路  3Comments

seanzer picture seanzer  路  3Comments