Skip to content

Commit

Permalink
fix: typing of forwardRef override
Browse files Browse the repository at this point in the history
  • Loading branch information
marklawlor committed May 31, 2022
1 parent 9f9cd6f commit 2745669
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/styled-component.tsx
Expand Up @@ -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>(
Expand Down

1 comment on commit 2745669

@vercel
Copy link

@vercel vercel bot commented on 2745669 May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.