Skip to content

Commit

Permalink
chore: rewrite withSplit with typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed Dec 14, 2023
1 parent 5ab7a16 commit 648370a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import ReactDOM from 'react-dom';
import {getDisplayName} from '../utils';
import {SPLIT_PANE_ID} from '../constants/index';

export default function withSplit(Component) {
return class WithSplit extends React.Component {
export default function withSplit<P>(Component: React.ComponentType<P>) {
return class WithSplit extends React.Component<P> {
static displayName = `WithSplit(${getDisplayName(Component)})`;

render() {
return ReactDOM.createPortal(
<Component {...this.props} />,
document.getElementById(SPLIT_PANE_ID),
document.getElementById(SPLIT_PANE_ID)!,
);
}
};
Expand Down

0 comments on commit 648370a

Please sign in to comment.