MCPcopy Index your code
hub / github.com/reactjs/react.dev / ComponentWithAs

Interface ComponentWithAs

src/utils/forwardRefWithAs.tsx:69–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67>;
68
69export interface ComponentWithAs<ComponentType extends As, ComponentProps> {
70 // These types are a bit of a hack, but cover us in cases where the `as` prop
71 // is not a JSX string type. Makes the compiler happy so 🤷‍♂️
72 <TT extends As>(
73 props: PropsWithAs<TT, ComponentProps>
74 ): React.ReactElement | null;
75 (
76 props: PropsWithAs<ComponentType, ComponentProps>
77 ): React.ReactElement | null;
78
79 displayName?: string;
80 propTypes?: ValidationMap<React.ReactNode>;
81 contextTypes?: ValidationMap<React.ReactNode>;
82 defaultProps?: Partial<PropsWithAs<ComponentType, ComponentProps>>;
83}
84
85/**
86 * This is a hack for sure. The thing is, getting a component to intelligently

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected