goatslacker / alt

Isomorphic flux implementation
http://alt.js.org/
3.45k stars 322 forks source link

Uncaught TypeError: this.dispatch is not a function #630

Open szahn opened 8 years ago

szahn commented 8 years ago

Is the TypeScript tutorial over at https://github.com/goatslacker/alt-tutorial/tree/master/src up to date? Getting some errors following that tutorial and wondering what I'm doing wrong. Trying to use to dispatcher but it apparently doesn't exist.

Typescript: 1.8.2

"use strict";
import alt = require("./alt");

/**
 * AltJS Flux Actions implementation
    {@link http://alt.js.org/guide/actions/} AltJS Actions
 */
class myActions implements AltJS.ActionsClass{
    constructor(alt: AltJS.Alt) {

    }

    dispatch: (...payload: Array<any>) => void;

    myAction(payload : any): void {
        this.dispatch(payload);
    }

}

export = alt.createActions<myActions>(myActions);
muhammad-saleh commented 8 years ago

As far as I know the dispatch was removed and replaced with a simple return but I tried to use that in the new version but couldn't get to work and still looking for a solution to get it working :)

See here that this.dispatch is being replaced with return: http://alt.js.org/guide/actions/

Celestz commented 8 years ago

is there any update on this? I'm also encountering this and also tried to replace it with return but it's not working properly.

gaurav414u commented 6 years ago

Not working. Any update guys?

jchen111 commented 6 years ago

Not working here as well.