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] Fixed type for "GetInputPropsOptions" #639

Merged
merged 1 commit into from
Jan 3, 2019

Conversation

franklixuefei
Copy link
Collaborator

According to the latest react types, we should also allow HTMLTextAreaElement as part of the props for GetInputPropsOptions

What:
Typescript type fix.

Why:
to make the type more accurate and prevent broken builds.

How:
I added HTMLTextAreaElement as part of the props to GetInputPropsOptions, according to the latest react type def.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

According to the latest `react` types, we should also allow `HTMLTextAreaElement` as part of the props for `GetInputPropsOptions`
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks!

@kentcdodds kentcdodds merged commit 0aa0c6d into master Jan 3, 2019
@kentcdodds kentcdodds deleted the franklixuefei-patch-1-1 branch January 3, 2019 03:24
@kentcdodds
Copy link
Member

There seems to be a problem with the build (something wrong with docz it looks like). This can't be released until that build is fixed 😬

franklixuefei added a commit that referenced this pull request Jan 5, 2019
Revert #639 
I decided to revert this change for the following reasons:
1. For now, downshift is not designed for textareas, so it doesn't make sense to account for the props that a textarea has in typings, which adds to the complexity of the type definitions.
2. this will no longer work (typescript compiler will throw):
```jsx
<input {...getInputProps(...)} />
```
because the returned type `React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>` cannot be assigned to `React.HTMLProps<HTMLInputElement>`
kentcdodds pushed a commit that referenced this pull request Jan 5, 2019
…641)

Revert #639 
I decided to revert this change for the following reasons:
1. For now, downshift is not designed for textareas, so it doesn't make sense to account for the props that a textarea has in typings, which adds to the complexity of the type definitions.
2. this will no longer work (typescript compiler will throw):
```jsx
<input {...getInputProps(...)} />
```
because the returned type `React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>` cannot be assigned to `React.HTMLProps<HTMLInputElement>`
@kentcdodds
Copy link
Member

🎉 This PR is included in version 3.1.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants