- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
TypeScriptRelated to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.Related to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.
Description
@testing-library/reactversion: 12.1.1- Testing Framework and version: jest@27.2.4
- typescript@4.4.3
Relevant code or config:
import {MemoryRouter as Router} from 'react-router-dom'; // ... render(<Whatever />, {wrapper: Router});What you did:
Use Router as wrapper.
What happened:
typescript compile error.
Problem description:
Overload 1 of 2, '(ui: ReactElement<any, string | JSXElementConstructor<any>>, options: RenderOptions<typeof import(".../node_modules/@testing-library/dom/types/queries"), HTMLElement>): RenderResult<...>', gave the following error. Type 'typeof MemoryRouter' is not assignable to type 'ComponentType<{ children: ReactElement<any, string | JSXElementConstructor<any>>; }> | undefined'. Type 'typeof MemoryRouter' is not assignable to type 'ComponentClass<{ children: ReactElement<any, string | JSXElementConstructor<any>>; }, any>'. Types of parameters 'props' and 'props' are incompatible. Type '{ children: ReactElement<any, string | JSXElementConstructor<any>>; }' is not assignable to type 'MemoryRouterProps | Readonly<MemoryRouterProps>'. Type '{ children: ReactElement<any, string | JSXElementConstructor<any>>; }' has no properties in common with type 'Readonly<MemoryRouterProps>'. Overload 2 of 2, '(ui: ReactElement<any, string | JSXElementConstructor<any>>, options?: Omit<RenderOptions<typeof import(".../node_modules/@testing-library/dom/types/queries"), HTMLElement>, "queries"> | undefined): RenderResult<...>', gave the following error. Type 'typeof MemoryRouter' is not assignable to type 'ComponentType<{ children: ReactElement<any, string | JSXElementConstructor<any>>; }> | undefined'. Type 'typeof MemoryRouter' is not assignable to type 'ComponentClass<{ children: ReactElement<any, string | JSXElementConstructor<any>>; }, any>'.rmaclean-ee, brianmcd, Clafouti, bernardobelchior, guilleironhack and 2 more
Metadata
Metadata
Assignees
Labels
TypeScriptRelated to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.Related to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.