Skip to content

Support for typed Actions #355

Closed
Closed
@razjel

Description

@razjel

I'm using Redux alongside with TypeScript and I created my custom class Action and ActionCreator

//Action.ts
export default class Action
{
    public type:string;
    public data:any;

    constructor(type:string, data:any = null)
    {
        this.type = type;
        this.data = data;
    }
}

// PhotoActions.ts
export function processPhoto(photoData:PhotoData)
{
    return new Action(PROCESS_PHOTO, photoData);
}

When I try to dispatch this action I get error Actions must be plain objects. Use custom middleware for async actions. Is it really necessary for action objects to be plain objects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions