fix(avatar): fix union types for different elements

This commit is contained in:
unix
2020-03-29 06:21:57 +08:00
parent 7d22fab670
commit f0ea95d2af

View File

@@ -21,8 +21,8 @@ const defaultProps = {
className: '',
}
type NativeAttrs = React.ImgHTMLAttributes<any> | React.HTMLAttributes<any>
export type AvatarProps = Props & typeof defaultProps & NativeAttrs
type NativeAttrs = React.ImgHTMLAttributes<any> & React.HTMLAttributes<any>
export type AvatarProps = Props & typeof defaultProps & Partial<NativeAttrs>
const getAvatarSize = (size: NormalSizes | number): string => {
if (typeof size === 'number') return `${size}px`