'Styled-component unexpected 'No overload matches this call.' type error when extending a compoonet

well i have this problem where i have a styled component that i am extending like this styled(Component) and for some of the Components i'm passing in i get strange type errors which some times appear and sometimes they don't it is very frustrating because it is causing my builds to fail. Here's the error:

No overload matches this call.
     Overload 1 of 2, '(component: AnyStyledComponent): ThemedStyledFunction<any, DefaultTheme, any, any>', gave the following error.
       Argument of type 'typeof Calendar' is not assignable to parameter of type 'AnyStyledComponent'.
         Type 'typeof Calendar' is not assignable to type 'StyledComponent<any, any, any, never>'.
           Type 'typeof Calendar' is not assignable to type 'string'.
     Overload 2 of 2, '(component: keyof IntrinsicElements | ComponentType<any>): ThemedStyledFunction<keyof IntrinsicElements | ComponentType<any>, DefaultTheme, {}, never>', gave the following error.
       Argument of type 'typeof Calendar' is not assignable to parameter of type 'keyof IntrinsicElements | ComponentType<any>'.
         Type 'typeof Calendar' is not assignable to type 'ComponentClass<any, any>'.
           Types of property 'contextType' are incompatible.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source