Typescript & Redux connect












0















I'm trying to connect redux to a component using Typescript and keep running into the same error.




Argument of type 'typeof BaseLayoutUnconnected' is not assignable to
parameter of type 'Component < any, {}, any>'. Property 'setState' is
missing in type 'typeof BaseLayoutUnconnected'.




import * as React from 'react';
import { IBaseLayoutProps, IBaseLayoutState } from './base-layout.types';
import { ChatContainer } from '../../components';
import { connect, DispatchProp } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { RouteComponentProps } from 'react-router';
import { ChatActions } from 'app/actions';
import { RootState } from 'app/reducers';
import { omit } from 'app/utils';

export const mapStateToProps = (state: RootState, ownProps) => {
return {
chatItems: state.chatItems
};
};

export const mapDispatchToProps = (dispatch: Dispatch) => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export class BaseLayoutUnconnected extends React.Component<IBaseLayoutProps, IBaseLayoutState> {
constructor(props) {
super(props);
this.state = {};
}

render() {
const { actions, chatItems } = this.props;
return <ChatContainer actions={actions} chatItems={chatItems} />;
}
}

export const BaseLayout = connect(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected);


This is being called in my app.tsx via



 <Route exact={true} path="/" component={BaseLayout} />


Here are the props and state



export interface IBaseLayoutProps {
chatItems: RootState.ChatState;
actions: ChatActions;
}

export interface IBaseLayoutState {}


ChatActions looks like



import { createAction } from 'redux-actions';
import { ChatItemModel } from 'app/models';

export namespace ChatActions {
export enum Type {
ADD_CHAT_ITEM = 'ADD_CHAT_ITEM'
}

export const addChatItem = createAction<PartialPick<ChatItemModel, 'text'>>(Type.ADD_CHAT_ITEM);
}

export type ChatActions = Omit<typeof ChatActions, 'Type'>;









share|improve this question

























  • try to add default values for this.state

    – Medet Tleukabiluly
    Nov 20 '18 at 19:14











  • Adding constructor(props) { super(props); this.state = {}; } doesn't fix the issue. Edited the original question to include that.

    – dliebeskind
    Nov 20 '18 at 19:18


















0















I'm trying to connect redux to a component using Typescript and keep running into the same error.




Argument of type 'typeof BaseLayoutUnconnected' is not assignable to
parameter of type 'Component < any, {}, any>'. Property 'setState' is
missing in type 'typeof BaseLayoutUnconnected'.




import * as React from 'react';
import { IBaseLayoutProps, IBaseLayoutState } from './base-layout.types';
import { ChatContainer } from '../../components';
import { connect, DispatchProp } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { RouteComponentProps } from 'react-router';
import { ChatActions } from 'app/actions';
import { RootState } from 'app/reducers';
import { omit } from 'app/utils';

export const mapStateToProps = (state: RootState, ownProps) => {
return {
chatItems: state.chatItems
};
};

export const mapDispatchToProps = (dispatch: Dispatch) => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export class BaseLayoutUnconnected extends React.Component<IBaseLayoutProps, IBaseLayoutState> {
constructor(props) {
super(props);
this.state = {};
}

render() {
const { actions, chatItems } = this.props;
return <ChatContainer actions={actions} chatItems={chatItems} />;
}
}

export const BaseLayout = connect(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected);


This is being called in my app.tsx via



 <Route exact={true} path="/" component={BaseLayout} />


Here are the props and state



export interface IBaseLayoutProps {
chatItems: RootState.ChatState;
actions: ChatActions;
}

export interface IBaseLayoutState {}


ChatActions looks like



import { createAction } from 'redux-actions';
import { ChatItemModel } from 'app/models';

export namespace ChatActions {
export enum Type {
ADD_CHAT_ITEM = 'ADD_CHAT_ITEM'
}

export const addChatItem = createAction<PartialPick<ChatItemModel, 'text'>>(Type.ADD_CHAT_ITEM);
}

export type ChatActions = Omit<typeof ChatActions, 'Type'>;









share|improve this question

























  • try to add default values for this.state

    – Medet Tleukabiluly
    Nov 20 '18 at 19:14











  • Adding constructor(props) { super(props); this.state = {}; } doesn't fix the issue. Edited the original question to include that.

    – dliebeskind
    Nov 20 '18 at 19:18
















0












0








0








I'm trying to connect redux to a component using Typescript and keep running into the same error.




Argument of type 'typeof BaseLayoutUnconnected' is not assignable to
parameter of type 'Component < any, {}, any>'. Property 'setState' is
missing in type 'typeof BaseLayoutUnconnected'.




import * as React from 'react';
import { IBaseLayoutProps, IBaseLayoutState } from './base-layout.types';
import { ChatContainer } from '../../components';
import { connect, DispatchProp } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { RouteComponentProps } from 'react-router';
import { ChatActions } from 'app/actions';
import { RootState } from 'app/reducers';
import { omit } from 'app/utils';

export const mapStateToProps = (state: RootState, ownProps) => {
return {
chatItems: state.chatItems
};
};

export const mapDispatchToProps = (dispatch: Dispatch) => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export class BaseLayoutUnconnected extends React.Component<IBaseLayoutProps, IBaseLayoutState> {
constructor(props) {
super(props);
this.state = {};
}

render() {
const { actions, chatItems } = this.props;
return <ChatContainer actions={actions} chatItems={chatItems} />;
}
}

export const BaseLayout = connect(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected);


This is being called in my app.tsx via



 <Route exact={true} path="/" component={BaseLayout} />


Here are the props and state



export interface IBaseLayoutProps {
chatItems: RootState.ChatState;
actions: ChatActions;
}

export interface IBaseLayoutState {}


ChatActions looks like



import { createAction } from 'redux-actions';
import { ChatItemModel } from 'app/models';

export namespace ChatActions {
export enum Type {
ADD_CHAT_ITEM = 'ADD_CHAT_ITEM'
}

export const addChatItem = createAction<PartialPick<ChatItemModel, 'text'>>(Type.ADD_CHAT_ITEM);
}

export type ChatActions = Omit<typeof ChatActions, 'Type'>;









share|improve this question
















I'm trying to connect redux to a component using Typescript and keep running into the same error.




Argument of type 'typeof BaseLayoutUnconnected' is not assignable to
parameter of type 'Component < any, {}, any>'. Property 'setState' is
missing in type 'typeof BaseLayoutUnconnected'.




import * as React from 'react';
import { IBaseLayoutProps, IBaseLayoutState } from './base-layout.types';
import { ChatContainer } from '../../components';
import { connect, DispatchProp } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { RouteComponentProps } from 'react-router';
import { ChatActions } from 'app/actions';
import { RootState } from 'app/reducers';
import { omit } from 'app/utils';

export const mapStateToProps = (state: RootState, ownProps) => {
return {
chatItems: state.chatItems
};
};

export const mapDispatchToProps = (dispatch: Dispatch) => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export class BaseLayoutUnconnected extends React.Component<IBaseLayoutProps, IBaseLayoutState> {
constructor(props) {
super(props);
this.state = {};
}

render() {
const { actions, chatItems } = this.props;
return <ChatContainer actions={actions} chatItems={chatItems} />;
}
}

export const BaseLayout = connect(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected);


This is being called in my app.tsx via



 <Route exact={true} path="/" component={BaseLayout} />


Here are the props and state



export interface IBaseLayoutProps {
chatItems: RootState.ChatState;
actions: ChatActions;
}

export interface IBaseLayoutState {}


ChatActions looks like



import { createAction } from 'redux-actions';
import { ChatItemModel } from 'app/models';

export namespace ChatActions {
export enum Type {
ADD_CHAT_ITEM = 'ADD_CHAT_ITEM'
}

export const addChatItem = createAction<PartialPick<ChatItemModel, 'text'>>(Type.ADD_CHAT_ITEM);
}

export type ChatActions = Omit<typeof ChatActions, 'Type'>;






reactjs typescript redux react-redux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 19:19







dliebeskind

















asked Nov 20 '18 at 19:06









dliebeskinddliebeskind

569




569













  • try to add default values for this.state

    – Medet Tleukabiluly
    Nov 20 '18 at 19:14











  • Adding constructor(props) { super(props); this.state = {}; } doesn't fix the issue. Edited the original question to include that.

    – dliebeskind
    Nov 20 '18 at 19:18





















  • try to add default values for this.state

    – Medet Tleukabiluly
    Nov 20 '18 at 19:14











  • Adding constructor(props) { super(props); this.state = {}; } doesn't fix the issue. Edited the original question to include that.

    – dliebeskind
    Nov 20 '18 at 19:18



















try to add default values for this.state

– Medet Tleukabiluly
Nov 20 '18 at 19:14





try to add default values for this.state

– Medet Tleukabiluly
Nov 20 '18 at 19:14













Adding constructor(props) { super(props); this.state = {}; } doesn't fix the issue. Edited the original question to include that.

– dliebeskind
Nov 20 '18 at 19:18







Adding constructor(props) { super(props); this.state = {}; } doesn't fix the issue. Edited the original question to include that.

– dliebeskind
Nov 20 '18 at 19:18














1 Answer
1






active

oldest

votes


















2














That's a problem i had too when i first started with Redux and TypeScript. There is a tricky solution. The connect methode takes alot of generics. I try to explain it with your example.



First of all you have to split the properties of your BaseLayoutUnconnected.



export interface IBaseLayoutStateProps {
chatItems: RootState.ChatState;
}

export interface IBaseLayoutDispatchProps {
actions: ChatActions;
}

export interface IBaseLayoutOwnProps {
// put properties here you want to make available from the connected component
}

export type IBaseLayoutProps = IBaseLayoutOwnProps & IBaseLayoutDispatchProps & IBaseLayoutStateProps

export interface IBaseLayoutState {}


Then you have to fill the generics of the different redux functions.



const mapStateToProps: MapStateToProps<IBaseLayoutStateProps, {}, RootState> = (state: RootState): IBaseLayoutStateProps => ({
chatItems: state.chatItems
})

export const mapDispatchToProps: MapDispatchToPropsFunction<IBaseLayoutDispatchProps, IBaseLayoutOwnProps> = (dispatch: Dispatch, ownProps: IBaseLayoutDispatchProps): IBaseLayoutDispatchProps => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export default connect<IBaseLayoutStateProps , IBaseLayoutDispatchProps, IBaseLayoutOwnProps , RootState>(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected as any)


a good source, where you can find all this stuff i wrote and more is this repository






share|improve this answer


























  • Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

    – dliebeskind
    Nov 20 '18 at 19:43











  • Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

    – Sly321
    Nov 20 '18 at 21:41











  • the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

    – dliebeskind
    Nov 20 '18 at 23:01











  • Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

    – Sly321
    Nov 21 '18 at 0:42








  • 1





    Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

    – Sly321
    Nov 21 '18 at 0:54











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399878%2ftypescript-redux-connect%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














That's a problem i had too when i first started with Redux and TypeScript. There is a tricky solution. The connect methode takes alot of generics. I try to explain it with your example.



First of all you have to split the properties of your BaseLayoutUnconnected.



export interface IBaseLayoutStateProps {
chatItems: RootState.ChatState;
}

export interface IBaseLayoutDispatchProps {
actions: ChatActions;
}

export interface IBaseLayoutOwnProps {
// put properties here you want to make available from the connected component
}

export type IBaseLayoutProps = IBaseLayoutOwnProps & IBaseLayoutDispatchProps & IBaseLayoutStateProps

export interface IBaseLayoutState {}


Then you have to fill the generics of the different redux functions.



const mapStateToProps: MapStateToProps<IBaseLayoutStateProps, {}, RootState> = (state: RootState): IBaseLayoutStateProps => ({
chatItems: state.chatItems
})

export const mapDispatchToProps: MapDispatchToPropsFunction<IBaseLayoutDispatchProps, IBaseLayoutOwnProps> = (dispatch: Dispatch, ownProps: IBaseLayoutDispatchProps): IBaseLayoutDispatchProps => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export default connect<IBaseLayoutStateProps , IBaseLayoutDispatchProps, IBaseLayoutOwnProps , RootState>(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected as any)


a good source, where you can find all this stuff i wrote and more is this repository






share|improve this answer


























  • Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

    – dliebeskind
    Nov 20 '18 at 19:43











  • Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

    – Sly321
    Nov 20 '18 at 21:41











  • the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

    – dliebeskind
    Nov 20 '18 at 23:01











  • Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

    – Sly321
    Nov 21 '18 at 0:42








  • 1





    Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

    – Sly321
    Nov 21 '18 at 0:54
















2














That's a problem i had too when i first started with Redux and TypeScript. There is a tricky solution. The connect methode takes alot of generics. I try to explain it with your example.



First of all you have to split the properties of your BaseLayoutUnconnected.



export interface IBaseLayoutStateProps {
chatItems: RootState.ChatState;
}

export interface IBaseLayoutDispatchProps {
actions: ChatActions;
}

export interface IBaseLayoutOwnProps {
// put properties here you want to make available from the connected component
}

export type IBaseLayoutProps = IBaseLayoutOwnProps & IBaseLayoutDispatchProps & IBaseLayoutStateProps

export interface IBaseLayoutState {}


Then you have to fill the generics of the different redux functions.



const mapStateToProps: MapStateToProps<IBaseLayoutStateProps, {}, RootState> = (state: RootState): IBaseLayoutStateProps => ({
chatItems: state.chatItems
})

export const mapDispatchToProps: MapDispatchToPropsFunction<IBaseLayoutDispatchProps, IBaseLayoutOwnProps> = (dispatch: Dispatch, ownProps: IBaseLayoutDispatchProps): IBaseLayoutDispatchProps => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export default connect<IBaseLayoutStateProps , IBaseLayoutDispatchProps, IBaseLayoutOwnProps , RootState>(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected as any)


a good source, where you can find all this stuff i wrote and more is this repository






share|improve this answer


























  • Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

    – dliebeskind
    Nov 20 '18 at 19:43











  • Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

    – Sly321
    Nov 20 '18 at 21:41











  • the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

    – dliebeskind
    Nov 20 '18 at 23:01











  • Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

    – Sly321
    Nov 21 '18 at 0:42








  • 1





    Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

    – Sly321
    Nov 21 '18 at 0:54














2












2








2







That's a problem i had too when i first started with Redux and TypeScript. There is a tricky solution. The connect methode takes alot of generics. I try to explain it with your example.



First of all you have to split the properties of your BaseLayoutUnconnected.



export interface IBaseLayoutStateProps {
chatItems: RootState.ChatState;
}

export interface IBaseLayoutDispatchProps {
actions: ChatActions;
}

export interface IBaseLayoutOwnProps {
// put properties here you want to make available from the connected component
}

export type IBaseLayoutProps = IBaseLayoutOwnProps & IBaseLayoutDispatchProps & IBaseLayoutStateProps

export interface IBaseLayoutState {}


Then you have to fill the generics of the different redux functions.



const mapStateToProps: MapStateToProps<IBaseLayoutStateProps, {}, RootState> = (state: RootState): IBaseLayoutStateProps => ({
chatItems: state.chatItems
})

export const mapDispatchToProps: MapDispatchToPropsFunction<IBaseLayoutDispatchProps, IBaseLayoutOwnProps> = (dispatch: Dispatch, ownProps: IBaseLayoutDispatchProps): IBaseLayoutDispatchProps => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export default connect<IBaseLayoutStateProps , IBaseLayoutDispatchProps, IBaseLayoutOwnProps , RootState>(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected as any)


a good source, where you can find all this stuff i wrote and more is this repository






share|improve this answer















That's a problem i had too when i first started with Redux and TypeScript. There is a tricky solution. The connect methode takes alot of generics. I try to explain it with your example.



First of all you have to split the properties of your BaseLayoutUnconnected.



export interface IBaseLayoutStateProps {
chatItems: RootState.ChatState;
}

export interface IBaseLayoutDispatchProps {
actions: ChatActions;
}

export interface IBaseLayoutOwnProps {
// put properties here you want to make available from the connected component
}

export type IBaseLayoutProps = IBaseLayoutOwnProps & IBaseLayoutDispatchProps & IBaseLayoutStateProps

export interface IBaseLayoutState {}


Then you have to fill the generics of the different redux functions.



const mapStateToProps: MapStateToProps<IBaseLayoutStateProps, {}, RootState> = (state: RootState): IBaseLayoutStateProps => ({
chatItems: state.chatItems
})

export const mapDispatchToProps: MapDispatchToPropsFunction<IBaseLayoutDispatchProps, IBaseLayoutOwnProps> = (dispatch: Dispatch, ownProps: IBaseLayoutDispatchProps): IBaseLayoutDispatchProps => ({
actions: bindActionCreators(omit(ChatActions, 'Type'), dispatch)
});

export default connect<IBaseLayoutStateProps , IBaseLayoutDispatchProps, IBaseLayoutOwnProps , RootState>(
mapStateToProps,
mapDispatchToProps
)(BaseLayoutUnconnected as any)


a good source, where you can find all this stuff i wrote and more is this repository







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 21:15









dliebeskind

569




569










answered Nov 20 '18 at 19:24









Sly321Sly321

458312




458312













  • Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

    – dliebeskind
    Nov 20 '18 at 19:43











  • Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

    – Sly321
    Nov 20 '18 at 21:41











  • the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

    – dliebeskind
    Nov 20 '18 at 23:01











  • Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

    – Sly321
    Nov 21 '18 at 0:42








  • 1





    Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

    – Sly321
    Nov 21 '18 at 0:54



















  • Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

    – dliebeskind
    Nov 20 '18 at 19:43











  • Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

    – Sly321
    Nov 20 '18 at 21:41











  • the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

    – dliebeskind
    Nov 20 '18 at 23:01











  • Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

    – Sly321
    Nov 21 '18 at 0:42








  • 1





    Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

    – Sly321
    Nov 21 '18 at 0:54

















Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

– dliebeskind
Nov 20 '18 at 19:43





Thanks @Sly321. Changed everything as you suggested, but getting similar error. It now says "Argument of type 'typeof BaseLayoutUnconnected' is not assignable to parameter of type 'Component < IBaseLayoutOwnProps, {}, any>'. Property 'setState' is missing in type 'typeof BaseLayoutUnconnected'."

– dliebeskind
Nov 20 '18 at 19:43













Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

– Sly321
Nov 20 '18 at 21:41





Where do you get the error? In the Router or in the Connect function? Do you have a repository where i can checkout the source?

– Sly321
Nov 20 '18 at 21:41













the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

– dliebeskind
Nov 20 '18 at 23:01





the error is occuring in the connect function. BaseLayoutUnconnected (in the connect function) is underlined.

– dliebeskind
Nov 20 '18 at 23:01













Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

– Sly321
Nov 21 '18 at 0:42







Since there is nothing missing in your code in my opinion, do you have all the requirements in your package.json? I'll post some package versions that work for me. "react":"16.4.2" "react-dom":"16.4.2" "react-redux":"5.0.7" "redux":"4.0.0" "@types/react-dom": "16.0.7" "@types/react-redux": "6.0.6" "@types/react-router-dom":"4.3.0" I don't have @types/react in this configuration, BUT i would definitly try out to add @types/react if there is a chance. A good idea is the command: yarn why @types/react try to find out if there a sideeffects from other packages

– Sly321
Nov 21 '18 at 0:42






1




1





Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

– Sly321
Nov 21 '18 at 0:54





Another idea, try to call BaseLayoutUnconnect in the connect like this connect<generics & stuff>(mapStateToProps, mapDispatchToProps)(BaseLayoutUnconnect as any as React.Component). If this still errors, then is something wrong with your @types configuration

– Sly321
Nov 21 '18 at 0:54




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399878%2ftypescript-redux-connect%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?