score:3
Accepted answer
I removed Component from destruction and casted type like this
const Component = this.props.component as React.ComponentType<{} & RouteComponentProps<{}>>;
This worked for me. I read it from here. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/17355#issuecomment-310544041
score:0
You should change PrivateRouteProps
{ component: typeof React.Component };
Should be
{ component: React.Component };
Source: stackoverflow.com
Related Query
- How to fix Type not assignable to LibraryManagedAttributes for react router render prop
- How to fix the type error Type '(string | Element) [] is not assignable to type 'string | Element | undefined' using react and typescript?
- How to fix error type void is not assignable to type using react and typescript?
- How to fix the error type Item[] | undefined is not assignable to Item[] type using react and typescript?
- How to fix React TypeScript error: Argument of type '""' is not assignable to parameter of type 'SetStateAction<undefined>'
- How to fix the date[] is not assignable to type [date?, date?] in react hook
- How to fix the Argument of type 'Date[]' is not assignable to parameter of type '(prevState: undefined) in react
- How to fix error "argument of type false is not assignable to (currentValue: boolean) => boolean" using react and typescript?
- How to fix error "argument of type (open: any) => boolean is not assignable to parameter of type boolean" using react and typescript?
- How to fix nextCreate is not a function setting up useMemo setting up authentication react router and hooks
- React Router 6 and Typescript - index attribute Type 'true' is not assignable to type 'false | undefined'.?
- How to fix React Router component not updating as route changes
- How to fix React Native App not building for iOS
- React + TypeScript: How to fix "return type 'Element[]' is not a valid JSX element."?
- How do I fix a React TypeScript error with the return value of useHotkeys hook not matching the type of the div element ref prop
- TypeScript errors in React Class Component property does not exist on type 'Readonly<{}>', not sure how to set types for state
- How can handle not found page for nested routing in react router v4?
- React router dom type error / FC{} | ReactNode is not assignable to type ReactNode
- How to fix "TypeError: Object(...) is not a function" when using a wrap function on React Component to authenticate user login with Browser Router
- How to fix type warning for radius settings in React app
- How to fix the error argument of type string or undefined is not assignable to parameter of type string using typescript and react?
- How to fix argument of type is is not assignable to parameter of type
- TypeScript Error: Type 'type' is not assignable to type 'IntrinsicAttributes & 'type' & { children?: ReactNode; }'. How to fix it?
- How to fix the 'setOption' does not exist on type 'MutableRefObject in react
- How to fix error argument of type undefined is not assignable to parameter of type 'string or () => string usng typescript and react?
- How to fix the error type void is not assignable to type ((event: MouseEvent<HTMLDivElement, MouseEvent>) => void) |undefined using react?
- How do I fix the webpack file for the React Router issue?
- Typescript react - Could not find a declaration file for module ''react-materialize'. 'path/to/module-name.js' implicitly has an any type
- React Typescript - Argument of type is not assignable to parameter of type
- How do I create a TypeScript type definition for a stateless React component?
More Query from same tag
- How to display response data array in my React app?
- to call onChange event after pressing Enter key
- Store values from multiple arrays into one array (JavaScript/Reactjs)
- How to download data as Excel (.xslx) in Nextjs
- how to get the 'e.key' of li element in react.js?
- How to start react app on custom port with CRACO?
- How to solve no-underscore-dangle error without making the error off in config
- Firebase returning two different outputs
- Why isn't MenuItemLink rendered inside the menu?
- React Router render component on a separate page
- Material-ui: Button in a tab list
- react-google-maps: Cannot find namespace 'google'
- Manage State when checkbox is checked/unchecked - React
- How do I conditionally redirect with react-router?
- open bootstrap modal programatically
- My search input and pagination aren't triggering anything in Reactjs
- Dynamically link static css in html
- React router 404 page rendering in all pages
- How to make image size dependent on the parents font size
- ReactJs - Issue in routering the component
- Force updates on installed PWA when changing index.html (prevent caching)
- useEffect for componentDidMount dependency
- Why do react MobileStoreButtons have different shapes?
- Please verify that the package.json has a valid "main" entry
- Why is my React component render called twice, once without data and then later with data, but too late exception?
- How to copy an object in the array to another array based on a specific value
- How do i select an object from local json and pass it to the state?
- How to open exteranal application on top of desktop using electron
- How to add smooth transitions to the React Native elements
- detail: "CSRF Failed: CSRF token missing or incorrect."