Skip to content

Commit

Permalink
fix: 🐛 correct hoc component props transport
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-xiao-jian committed May 24, 2020
1 parent cea7ba7 commit 8e6a012
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/tools/with-default-props.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// packages
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';

export default function withDefaultProps<P>(defaultProps: P) {
return (Component: ComponentType<P>) => (props: Partial<P>) => (
<Component {...defaultProps} {...props} />
);
return (Component: ComponentType<P>) => (
props: PropsWithChildren<Partial<P>>
) => <Component {...defaultProps} {...props} />;
}

0 comments on commit 8e6a012

Please sign in to comment.