Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### BREAKING
- Rename `DropdownLabel` to `DropdownSelectedItem` and extract styles @layershifter ([#725](https://github.com/stardust-ui/react/pull/725))
- Make element type of component's event handler to be `HTMLElement` @kuzhelov ([#740](https://github.com/stardust-ui/react/pull/740))

### Fixes
- Remove `render` from default factories options @layershifter ([#735](https://github.com/stardust-ui/react/pull/735))
Expand Down
5 changes: 4 additions & 1 deletion types/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export type ReactChildren = React.ReactNodeArray | React.ReactNode
export type ReactPropsStrict<T> = { [K in keyof T]: NullableIfUndefined<T[K]> }
export type ReactProps<T> = Extendable<ReactPropsStrict<T>>

export type ComponentEventHandler<TProps> = (event: React.SyntheticEvent, data: TProps) => void
export type ComponentEventHandler<TProps> = (
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export type ComponentEventHandler<TProps> = (
export type ComponentEventHandler<TProps, TElem = HTMLElement> = (

Can we make this a generic?

Copy link
Contributor Author

@kuzhelov kuzhelov Jan 17, 2019

Choose a reason for hiding this comment

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

yes, although not sure whether it is necessary to introduce this variability now, as it is pretty much clear that it will always be about HTMLElement for this handler's type - thus, not sure if we should make this type to be customizable (as it will, probably, will be an indication of some improper assumptions)

event: React.SyntheticEvent<HTMLElement>,
data: TProps,
) => void

type ChildrenProps = { children: any }
export type PropsOf<T> = T extends React.ComponentClass<Extendable<infer TProps>>
Expand Down