Happy if someone might point out an obvious fix for this. After creating a project with the template on VS 2017 15.7.1, I get a bunch of errors. Example:
Code in: FetchData.tsx
export default connect(
(state: ApplicationState) => state.weatherForecasts, // Selects which state properties are merged into the component's props
WeatherForecastsState.actionCreators // Selects which action creators are merged into the component's props
)(FetchData) as typeof FetchData;
With error:
Severity Code Description Project File Line Suppression State
Error TS2345 (TS) Argument of type 'typeof FetchData' is not assignable to parameter of type 'Component'.
Type 'typeof FetchData' is not assignable to type 'StatelessComponent'.
Type 'typeof FetchData' provides no match for the signature '(props: WeatherForecastsState & { children?: ReactNode; }, context?: any): ReactElement | null'. C:\dev\CSharp\ReactRedux (tsconfig or jsconfig project) C:\dev\CSharp\ReactRedux\ClientApp\components\FetchData.tsx 73 Active
I was able to re-write another component into this code which removed the compiler error there.
const mapStateToProps = (state: ApplicationState) => {
return state.counter
};
const mapDispatchToProps = (dispatch: Dispatch<any>) => {
return CounterStore.actionCreators
};
// Wire up the React component to the Redux store
export default connect<StateProps, DispatchProps, {}>(mapStateToProps, mapDispatchToProps)(Counter) as typeof Counter;
So my question is what setting I may be missing? Versions are like this:
Happy if someone might point out an obvious fix for this. After creating a project with the template on VS 2017 15.7.1, I get a bunch of errors. Example:
Code in: FetchData.tsx
With error:
Severity Code Description Project File Line Suppression State Error TS2345 (TS) Argument of type 'typeof FetchData' is not assignable to parameter of type 'Component'.
Type 'typeof FetchData' is not assignable to type 'StatelessComponent'.
Type 'typeof FetchData' provides no match for the signature '(props: WeatherForecastsState & { children?: ReactNode; }, context?: any): ReactElement | null'. C:\dev\CSharp\ReactRedux (tsconfig or jsconfig project) C:\dev\CSharp\ReactRedux\ClientApp\components\FetchData.tsx 73 Active
I was able to re-write another component into this code which removed the compiler error there.
So my question is what setting I may be missing? Versions are like this: