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 for Auto-complete #12793

Closed
jon-r opened this Issue Oct 23, 2018 · 6 comments

Comments

Projects
None yet
6 participants
@jon-r

jon-r commented Oct 23, 2018

  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.10.2

Environment

  • mac OS 10.13
  • Intellij IDE 2018.2
  • react 16.4.2
  • typescript 3.0.1

Reproduction link

https://gist.github.com/jon-r/3078a56733440dcdf8d87c98219450b2

Steps to reproduce

The onFocus type does not exist in the AutoComplete prop interface.
Pasting the demo gist into an existing react tsx project will raise a type error

What is expected?

that onFocus is a valid prop

What is actually happening?

TS2339 'on focus does not exist on ... AutoCompleteProps'

@afc163

This comment has been minimized.

Member

afc163 commented Oct 23, 2018

PR is welcome~

@afc163 afc163 added the help wanted label Oct 23, 2018

@jon-r

This comment has been minimized.

jon-r commented Oct 23, 2018

testing this, it is just the interface that needs changing, functionally works the same

        const AutoCompleteAllowProps = AutoComplete as any;
        const field =  (
            <AutoCompleteAllowProps
                onFocus={this.setFocused}
                {...fieldProps}
            />
        );

will correctly trigger the focus event

@alireza-mh

This comment has been minimized.

Contributor

alireza-mh commented Oct 27, 2018

@jon-r i tried and everything was fine and i couldn't replicate the error.
also i tried it on stackblitz and everything was fine there as well.
https://stackblitz.com/edit/react-ts-cn2dqa

@zombieJ

This comment has been minimized.

Member

zombieJ commented Oct 29, 2018

hi @jon-r, could you provide an online reproduce about this? Since onFocus is defined: https://unpkg.com/antd@3.10.3/lib/auto-complete/index.d.ts

@muzea

This comment has been minimized.

Contributor

muzea commented Oct 29, 2018

@zombieJ

This comment has been minimized.

Member

zombieJ commented Oct 29, 2018

Maybe its on 3.10.0.

@muzea, let's close this issue first but still continue work with your PR : )

@zombieJ zombieJ closed this Oct 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment