I have the following interfaces:
export interface AsyncRouteComponent<Props> extends React.Component<Props, AsyncRouteComponentState> {
getInitialProps: ({ assets, data, renderPage }: DocumentProps) => any;
load: () => Promise<React.ReactNode>;
}
export interface AsyncRouteComponentClass<Props> extends AsyncRouteComponent<Props> {
new (props: Props): AsyncRouteComponent<Props>;
getInitialProps: ({ assets, data, renderPage }: DocumentProps) => any;
load: () => Promise<React.ReactNode>;
}
export interface AsyncRouteStateless<Props> extends AsyncRouteComponent<Props> {
(props: Props): AsyncRouteComponent<Props>;
getInitialProps: ({ assets, data, renderPage }: DocumentProps) => any;
load: () => Promise<React.ReactNode>;
}
They all have getInitialProps and load but are different in what they extend.
How can I reduce the duplication in these interfaces?