You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import React from 'react';
// import {withRouter} from 'react-router-dom';
import {withTracker} from 'meteor/react-meteor-data';
import {RouteComponentProps, withRouter} from 'react-router-dom';
interface IProps extends RouteComponentProps<any> {
title: string;
}
class MyComp extends React.Component<IProps> {
public render(): JSX.Element {
return <h1>{this.props.title}</h1>;
}
}
export default withRouter<IProps, typeof MyComp>(
withTracker(() => {
return {title: 'ok'};
})(MyComp)
);
Error:
Description
TS2345: Argument of type 'ComponentClass<unknown, any>' is not assignable to parameter of type 'typeof MyComp & ComponentType<IProps>'. Type 'ComponentClass<unknown, any>' is not assignable to type 'typeof MyComp & ComponentClass<IProps, any>'. Type 'ComponentClass<unknown, any>' is not assignable to type 'typeof MyComp'. Construct signature return types 'Component<unknown, any, any>' and 'MyComp' are incompatible. The types returned by 'render()' are incompatible between these types. Type 'ReactNode' is not assignable to type 'Element'. Type 'undefined' is not assignable to type 'ReactElement<any, any>'.
The text was updated successfully, but these errors were encountered:
gustawdaniel
changed the title
TS2345: Argument of type 'ComponentClass<unknown, any>' is not assignable to parameter of type 'typeof MyComp & ComponentType<IProps>'.<br/>Type 'ComponentClass<unknown, any>' is not assignable to type 'typeof MyComp & ComponentClass<IProps, any>'.<br/>Type 'ComponentClass<unknown, any>' is not assignable to type 'typeof MyComp'.<br/>Construct signature return types 'Component<unknown, any, any>' and 'MyComp' are incompatible.<br/>The types returned by 'render()' are incompatible between these types.<br/>Type 'ReactNode' is not assignable to type 'Element'.<br/>Type 'undefined' is not assignable to type 'ReactElement<any, any>'.
Example of usage meteor/react-meteor-data with withRouter in typescript
Nov 3, 2022
I am using this package with typescript
https://packosphere.com/meteor/react-meteor-data
My code
Error:
Description
The text was updated successfully, but these errors were encountered: