-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MockedProvider has incorrect typescript signature #7825
Labels
Comments
@espretto Thanks for noticing this and reporting it! We'll take a look shortly. |
2 tasks
The type is being overridden on purpose to make
// DOM Elements
// ReactHTMLElement
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
element: DetailedReactHTMLElement<P, T>,
props?: P,
...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
// ReactHTMLElement, less specific
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
element: ReactHTMLElement<T>,
props?: P,
...children: ReactNode[]): ReactHTMLElement<T>;
// SVGElement
function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
element: ReactSVGElement,
props?: P,
...children: ReactNode[]): ReactSVGElement;
// DOM Element (has to be the last, because type checking stops at first overload that fits)
function cloneElement<P extends DOMAttributes<T>, T extends Element>(
element: DOMElement<P, T>,
props?: DOMAttributes<T> & P,
...children: ReactNode[]): DOMElement<P, T>;
// Custom components
function cloneElement<P>(
element: FunctionComponentElement<P>,
props?: Partial<P> & Attributes,
...children: ReactNode[]): FunctionComponentElement<P>;
function cloneElement<P, T extends Component<P, ComponentState>>(
element: CElement<P, T>,
props?: Partial<P> & ClassAttributes<T>,
...children: ReactNode[]): CElement<P, T>;
function cloneElement<P>(
element: ReactElement<P>,
props?: Partial<P> & Attributes,
...children: ReactNode[]): ReactElement<P>; This should work appropriately: kevinperaza#2 |
Thanks @kevinperaza! It looks the PR wasn't opened up against the correct base. Could you please change that? Then I can get it merged. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
By extending
React.Component
theMockedProvider
already has a typed propertychildren
of typeReact.ReactNode
. The interfaceMockedProviderProps
incorrectly overrides it w/React.ReactElement
.The error occurs for example when trying to preset the provider. This is how to re-produce the error:
Typescript language-server error message:
The exact code-line is
apollo-client/src/utilities/testing/mocking/MockedProvider.tsx
Line 18 in f498900
The text was updated successfully, but these errors were encountered: