Skip to content

Commit

Permalink
type(List): fix TagType type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 19, 2023
1 parent 154aa3d commit e24cfe1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/react-avatar/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Icon, { IconProps, TagType } from '@uiw/react-icon';
import Icon, { IconProps, IconTagType } from '@uiw/react-icon';
import { HTMLSpanProps, noop } from '@uiw/utils';
import './style/index.less';
import { useState } from 'react';
Expand All @@ -9,7 +9,7 @@ export interface AvatarProps extends HTMLSpanProps {
style?: React.CSSProperties;
className?: string;
prefixCls?: string;
icon?: IconProps<TagType>['type'];
icon?: IconProps<IconTagType>['type'];
alt?: string;
src?: string;
size?: 'large' | 'default' | 'small' | 'mini';
Expand Down
8 changes: 4 additions & 4 deletions packages/react-icon/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import svgPaths from '@uiw/icons/fonts/w-icon.json';
import './style/index.less';

export type IconsName = keyof typeof svgPaths;
export type TagType = React.ElementType | keyof JSX.IntrinsicElements;
type ElementProps<T extends TagType, E = React.ReactElement> = {
export type IconTagType = React.ElementType | keyof JSX.IntrinsicElements;
type ElementProps<T extends IconTagType, E = React.ReactElement> = {
fill?: string;
style?: React.CSSProperties;
className?: string;
Expand All @@ -20,9 +20,9 @@ type ElementProps<T extends TagType, E = React.ReactElement> = {
verticalAlign?: 'middle' | 'baseline';
};

export type IconProps<T extends TagType> = ElementProps<T> & React.ComponentPropsWithoutRef<T>;
export type IconProps<T extends IconTagType> = ElementProps<T> & React.ComponentPropsWithoutRef<T>;

const Icon = <T extends TagType = 'span'>(props: IconProps<T>) => {
const Icon = <T extends IconTagType = 'span'>(props: IconProps<T>) => {
const {
className,
prefixCls = 'w-icon',
Expand Down
2 changes: 1 addition & 1 deletion packages/react-list/src/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import { IProps } from '@uiw/utils';

export type TagType = React.ComponentType | keyof JSX.IntrinsicElements;
type TagType = React.ComponentType | keyof JSX.IntrinsicElements;

export interface ListItemProps<Tag extends TagType> extends IProps, React.HTMLProps<Tag> {
disabled?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-menu/src/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import Icon, { IconProps } from '@uiw/react-icon';
import Icon, { IconProps, IconTagType } from '@uiw/react-icon';
import { IProps } from '@uiw/utils';
import './style/item.less';

Expand All @@ -22,7 +22,7 @@ export interface MenuItemProps<Tag extends TagType> extends IProps, React.HTMLPr
isSubMenuItem?: boolean;
disabled?: boolean;
active?: boolean;
icon?: IconProps['type'];
icon?: IconProps<IconTagType>['type'];
children?: React.ReactNode;
}

Expand Down

0 comments on commit e24cfe1

Please sign in to comment.