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

[InputGroup] Refactor API to extend HTMLInputProps #943

Closed
cmslewis opened this issue Apr 4, 2017 · 3 comments
Closed

[InputGroup] Refactor API to extend HTMLInputProps #943

cmslewis opened this issue Apr 4, 2017 · 3 comments

Comments

@cmslewis
Copy link
Contributor

cmslewis commented Apr 4, 2017

We should refactor IInputGroupProps to extend from HTMLInputProps, so that users can add custom callbacks on focus, on blur, and so on. The problem at present is that IInputGroupProps already extends from IControlledProps, which exposes props that conflict with some of those also included in HTMLInputProps (in particular: onChange, defaultValue, and value). Here's the exact set of errors you see:

[ts]
Interface 'IInputGroupProps' cannot simultaneously extend types 'IControlledProps' and 'HTMLProps<HTMLInputElement>'.
  Named property 'defaultValue' of types 'IControlledProps' and 'HTMLProps<HTMLInputElement>' 
  are not identical.

[ts]
Interface 'IInputGroupProps' cannot simultaneously extend types 'IControlledProps' and 'HTMLProps<HTMLInputElement>'.
  Named property 'onChange' of types 'IControlledProps' and 'HTMLProps<HTMLInputElement>' are 
  not identical.

[ts]
Interface 'IInputGroupProps' cannot simultaneously extend types 'IControlledProps' and 'HTMLProps<HTMLInputElement>'.
  Named property 'value' of types 'IControlledProps' and 'HTMLProps<HTMLInputElement>' are not 
  identical.

EDIT: There may be a better way to achieve this; the goal is primarily to expose the HTML Input lifecycle callbacks somehow.

@cmslewis cmslewis added this to the 2.x milestone Apr 4, 2017
@giladgray
Copy link
Contributor

i wonder about adding something like htmlProps as a generic way for Blueprint components to support arbitrary spreads?

@cmslewis
Copy link
Contributor Author

cmslewis commented Apr 4, 2017

^ Definitely think that's worth exploring.

@llorca
Copy link
Contributor

llorca commented Nov 30, 2017

in the React types, we use HTMLProps, but there's also HTMLAttributes (HTMLProps minus the React attributes). We should probably always use HTMLAttributes

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

No branches or pull requests

3 participants