Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript error when using autoComplete #172

Open
rikusgoosen opened this issue Nov 15, 2019 · 0 comments
Open

TypeScript error when using autoComplete #172

rikusgoosen opened this issue Nov 15, 2019 · 0 comments

Comments

@rikusgoosen
Copy link

Thank you for this library! I want to prevent the browser showing previous input values over the time picker overlay:
overlay

When adding the autoComplete={'off'} attribute like so:

import * as React from 'react'
import TimePicker from 'rc-time-picker'
import 'rc-time-picker/assets/index.css'

const MyTimePicker: React.FunctionComponent<any> = ({className, name, onChange}) => {
    const classNames = [className, 'my-time-input'].join(' ')
    return <>
        <TimePicker className={classNames} name={name} autoComplete={'off'}/>
    </>
}

export default MyTimePicker

the TypeScript compiler is giving the following error:

TS2769: No overload matches this call.
  Overload 1 of 2, '(props: Readonly<TimePickerProps>): TimePicker', gave the following error.
    Type '{ className: string; name: any; onChange: any; autoComplete: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TimePicker> & Readonly<TimePickerProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'autoComplete' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TimePicker> & Readonly<TimePickerProps> & Readonly<{ children?: ReactNode; }>'.
  Overload 2 of 2, '(props: TimePickerProps, context?: any): TimePicker', gave the following error.
    Type '{ className: string; name: any; onChange: any; autoComplete: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TimePicker> & Readonly<TimePickerProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'autoComplete' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TimePicker> & Readonly<TimePickerProps> & Readonly<{ children?: ReactNode; }>'.

To remove the error I added autoComplete?: 'off' | 'on'; in index.d.ts.
Am I using the TimePicker incorrectly, or should the autoComplete property be added to index.d.ts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant