fix: typing of forwardRef override

This commit is contained in:
Mark Lawlor
2022-05-31 11:29:53 +10:00
parent 9f9cd6fb0e
commit 2745669296

View File

@@ -6,11 +6,17 @@ export type StyledComponentProps<P> = StyledProps<P> & {
component: React.ComponentType<P>;
};
/**
* This might cause issues in the future, but we provide an override of forwardRef
* to provide better typing of our components
*/
declare module "react" {
// eslint-disable-next-line @typescript-eslint/ban-types
function forwardRef<T, P = {}>(
render: (props: P, ref: React.Ref<T>) => React.ReactElement | null
): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
): React.ForwardRefExoticComponent<
React.PropsWithoutRef<P> & React.RefAttributes<T>
>;
}
function StyledComponentFunction<P>(