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
react-router: withRouter
fails with ComponentType
starting in 3.6.2
#38271
Comments
I won't have time to dig into this. I think we should just remove any usage of |
Got the same issue. Already reported on the react-router repo (remix-run/react-router#6906) but got redirected to here. |
I'm still seeing issues even after this fix. Error message is something like
with the component defined as import { RouteComponentProps, withRouter } from "react-router-dom";
interface Props extends RouteComponentProps {
myProp: boolean;
}
const Component = ({ myProp, match }: Props) => null
export default withRouter(Component); I'm using
|
@karol-majewski I am on TS 3.6.3 and the latest version export function withRouter<P extends RouteComponentProps<any>, C extends React.ComponentType<P>>(
component: C & React.ComponentType<P>,
): React.ComponentClass<Omit<P, keyof RouteComponentProps<any>> & WithRouterProps<C>> & WithRouterStatics<C>; |
I encourage everyone to open new issues. If we fix your particular issue you have no way of being notified if you only comment in a closed thread. The typescript playground now allows configuring the ts version + config and is able to download type definitions. Including a link in a new issue helps maintainers a lot. Thank you 🙏 It seems like this only throws with |
IIRC, @eps1lon discovered that this is due to a TypeScript bug: microsoft/TypeScript#33490 Fix will come in: microsoft/TypeScript#34607. |
Issues are described in DefinitelyTyped/DefinitelyTyped#38271 Root cause is stated to be an issue with TS microsoft/TypeScript#34607 which has since been fixed in master. Commiting now to prevent issues, but would also like to revert this and try again when TS fix ships (TS 3.7?)
Works fine with the nightly version. Playground Link |
IIRC, I added this while tracking down the issues described in DefinitelyTyped/DefinitelyTyped#38271 It could have been another error, but we're not _supposed_ to have to add this dependency. I added it trying to suppress errors. Seeing if I can remove it and have the same results we currently have.
typescript is a waste of time, I have spent hours trying to solve this stupid error and nothins, so if typescript is made to make life easier it is definately not doing the job, full of errors and bugs |
This issue was fixed in TS 3.7. Closing. |
This worked in 3.5.2, but fails in 3.6.2.
strict
mode is disabled.Is this a bug in the typings or TypeScript?
I added failing tests for this here: f036856.
If you know how to fix the issue, make a pull request instead.
@types/xxxx
package and had problems.Definitions by:
inindex.d.ts
) so they can respond.If you do not mention the authors the issue will be ignored.
The text was updated successfully, but these errors were encountered: