diff --git a/package.json b/package.json index fb90d2b1..47367ed3 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "@types/classnames": "^2.2.10", "@types/enzyme": "^3.10.5", "@types/jest": "^25.1.3", - "@types/react": "^16.8.19", - "@types/react-dom": "^16.8.4", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", "@types/warning": "^3.0.0", "cross-env": "^5.2.0", "dumi": "^1.1.12", diff --git a/src/List.tsx b/src/List.tsx index 4f9c9b92..35d83c64 100644 --- a/src/List.tsx +++ b/src/List.tsx @@ -37,7 +37,7 @@ export type ListRef = { scrollTo: ScrollTo; }; -export interface ListProps extends React.HTMLAttributes { +export interface ListProps extends Omit, 'children'> { prefixCls?: string; children: RenderFunc; data: T[]; @@ -277,10 +277,13 @@ export function RawList(props: ListProps, ref: React.Ref) { componentRef.current.addEventListener('MozMousePixelScroll', onMozMousePixelScroll); return () => { - if(componentRef.current) { + if (componentRef.current) { componentRef.current.removeEventListener('wheel', onRawWheel); componentRef.current.removeEventListener('DOMMouseScroll', onFireFoxScroll as any); - componentRef.current.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll as any); + componentRef.current.removeEventListener( + 'MozMousePixelScroll', + onMozMousePixelScroll as any, + ); } }; }, [useVirtual]); @@ -381,5 +384,5 @@ const List = React.forwardRef>(RawList); List.displayName = 'List'; export default List as ( - props: React.PropsWithChildren> & { ref?: React.Ref }, + props: ListProps & { ref?: React.Ref }, ) => React.ReactElement;