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

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

Typescript Error for Auto-complete #12793

jon-r opened this issue Oct 23, 2018 · 6 comments
Labels

Comments

@jon-r
Copy link

@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
Copy link
Member

@afc163 afc163 commented Oct 23, 2018

PR is welcome~

@afc163 afc163 added the help wanted label Oct 23, 2018
@jon-r
Copy link
Author

@jon-r 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
Copy link
Contributor

@alireza-mh 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
Copy link
Member

@zombieJ 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
Copy link
Contributor

@muzea muzea commented Oct 29, 2018

@zombieJ
Copy link
Member

@zombieJ 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 : )

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

Successfully merging a pull request may close this issue.

6 participants