@navinc/base-react-components
Version:
Nav's Pattern Library
10 lines (9 loc) • 1.01 kB
TypeScript
import type { ComponentType, ComponentProps, JSXElementConstructor } from 'react';
import type { AnyStyledComponent, StyledComponent, StyledComponentProps, StyledComponentInnerComponent, StyledComponentInnerOtherProps, StyledComponentInnerAttrs } from 'styled-components';
declare type InferStyledComponentProps<C extends AnyStyledComponent> = StyledComponentProps<StyledComponentInnerComponent<C>, any, StyledComponentInnerOtherProps<C>, StyledComponentInnerAttrs<C>> & {
as?: never | undefined;
forwardedAs?: never | undefined;
};
export declare type InferComponentProps<T> = Omit<T extends AnyStyledComponent ? InferStyledComponentProps<T> : T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> ? ComponentProps<T> : never, 'ref'>;
export declare type PolymorphicStyledComponent<BaseComponent extends AnyStyledComponent, AsComponent extends ComponentType<any>> = StyledComponent<StyledComponentInnerComponent<AsComponent>, any, InferStyledComponentProps<BaseComponent>, never>;
export {};