Closed ioulian closed 1 year ago
Better:
import { ComponentPropsWithRef, JSXElementConstructor } from "react";
import {
AnyStyledComponent,
StyledComponentInnerComponent,
StyledComponentInnerOtherProps,
} from "styled-components";
export type InferStyledComponentProps<T> = T extends AnyStyledComponent
? ComponentPropsWithRef<StyledComponentInnerComponent<T>> &
StyledComponentInnerOtherProps<T>
: // eslint-disable-next-line no-undef
T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>
? ComponentPropsWithRef<T>
: never;
InferStyledComponentProps -> InferComponentProps
import { ComponentProps } from "react"; import { StyledComponentInnerComponent, StyledComponentInnerOtherProps, AnyStyledComponent, StyledComponentPropsWithRef, } from "styled-components";
export type inferStyledTypes = ComponentProps<
StyledComponentInnerComponent