-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
use HTMLAttributes instead of HTMLProps #2269
Conversation
ensure HTMLAttrs appears last in extends list
fix buttons HTMLAttributesPreview: documentation | landing | table |
Card supports HTML propsPreview: documentation | landing | table |
@@ -56,7 +56,10 @@ export interface IButtonState { | |||
isActive: boolean; | |||
} | |||
|
|||
export abstract class AbstractButton<T> extends React.Component<React.HTMLProps<T> & IButtonProps, IButtonState> { | |||
export abstract class AbstractButton<H extends React.HTMLAttributes<any>> extends React.PureComponent< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emoji didn't come though, it's just a square. what's the sentiment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes very nice
@@ -10,8 +10,7 @@ import * as Classes from "../../common/classes"; | |||
import { IProps } from "../../common/props"; | |||
|
|||
// allow the empty interface so we can label it clearly in the docs | |||
// tslint:disable-next-line:no-empty-interface | |||
export interface INavbarDividerProps extends React.HTMLProps<HTMLDivElement>, IProps { | |||
export interface INavbarDividerProps extends IProps, React.HTMLAttributes<HTMLDivElement> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pro tip: div
and span
don't have special attrs so they both use HTMLAttributes<T>
but other elements like label
or input
have their own LabelHTMLAttributes<T>
interfaces
HTMLDivProps type aliasPreview: documentation | landing | table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one change, then LGTM
@@ -48,7 +48,7 @@ export interface IInputGroupState { | |||
rightElementWidth?: number; | |||
} | |||
|
|||
export class InputGroup extends React.PureComponent<HTMLInputProps & IInputGroupProps, IInputGroupState> { | |||
export class InputGroup extends React.PureComponent<IInputGroupProps & HTMLInputProps, IInputGroupState> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend interface instead of &
the types (as per convention elsewhere)
comment about input group propsPreview: documentation | landing | table |
part of #2266. fixes #2181.
ensure
HTMLAttributes
appears last in extends list (otherwise it breaks the interface tables)