-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Controlled TextFields type bug #11927
Labels
Area: Documentation
Area: Typescript
Component: TextField
Status: Fixed
Fixed in some PR
Type: Bug 🐛
Comments
@gregdegruy - thanks for reporting! I will fix this. |
2 tasks
msft-github-bot
pushed a commit
that referenced
this issue
Feb 12, 2020
… is true (#11928) #### Pull request checklist - [x] Addresses an existing issue: Fixes #11927 - [x] Include a change request file using `$ yarn change` #### Description of changes Fix the typing error for `onChange` inside TextField examples when `strictFunctionTypes` is set to `true` ``` TS2322: Type '(ev: React.FormEvent<HTMLInputElement>, newValue?: string | undefined) => void' is not assignable to type '(event: FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string | undefined) => void'. Types of parameters 'ev' and 'event' are incompatible. Type 'FormEvent<HTMLInputElement | HTMLTextAreaElement>' is not assignable to type 'FormEvent<HTMLInputElement>'. Type 'HTMLInputElement | HTMLTextAreaElement' is not assignable to type 'HTMLInputElement'. Type 'HTMLTextAreaElement' is missing the following properties from type 'HTMLInputElement': accept, align, alt, checked, and 23 more. ```
🎉This issue was addressed in #11928, which has now been successfully released as Handy links: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Area: Documentation
Area: Typescript
Component: TextField
Status: Fixed
Fixed in some PR
Type: Bug 🐛
Environment Information
Please provide a reproduction of the bug in a codepen:
Load the TextField samples for Controlled TextFields in codepen or in local text editor.
Actual behavior:
The Controlled TextField example uses incorrect types. The onchange methods
private _onChangeX = (ev: React.FormEvent<HTMLInputElement>, newValue?: string) => {
should instead beprivate _onChangeX = (ev: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
.Expected behavior:
App builds, compiles, and starts.
Priorities and help requested:
Are you willing to submit a PR to fix? Yes
Requested priority: Normal
The text was updated successfully, but these errors were encountered: