Coder Social home page Coder Social logo

alt-typescript-tutorial's People

Contributors

shearerbeard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

alt-typescript-tutorial's Issues

Problem in store:

Hi Shearer

Hope u doing well.
I am working on migrating my company current project which is written into react using alt framework
into typescript.
As I am new in typescript and with the help of your code , I am trying to convert my existing code into typescript.
But when I run your code in my local environment it shows following error on store. which does not allow me to run the project in browser.

image

Can you please help me in resolving this.
Your recruitment will be grateful.

Problem in store: Uncaught ReferenceError: Invalid action reference passed in

I implemented an example project exactly like this one but I'm getting Uncaught ReferenceError: Invalid action reference passed in. This error is thrown at runtime in my store at this.bindListeners: ClassName.methodName

I found the error on the altjs doc page, but my Actions are of the same structure as the one in the example:

interface Actions{
    refreshComponentLibrary():void;
    componentLibraryRefreshed(componentLibrary: MqtlComponent[]):void;
    componentLibraryRefreshFailed(errorMsg:string):void;
}

class ComponentLibraryActions extends AbstractActions implements Actions{

    constructor(){
        super(altInstance);
        this.generateActions(
            "refreshComponentLibrary",
            "componentLibraryRefreshed",
            "componentLibraryRefreshFailed"
        )
    }

    refreshComponentLibrary = () => {
        console.log("ACTION!!! Refresh comp library");
        this.dispatch();

        //Trigger async
        ComponentLibraryStore.fetchComponentsFromServer();
    }

    componentLibraryRefreshed = (componentLibrary: MqtlComponent[]) => {
        console.log("Dispatch action: Library refreshed");
        this.dispatch(componentLibrary);
    }

    componentLibraryRefreshFailed = (errorMsg: string) => {
        console.log("Dispatch action: Library refresh failed");
        this.dispatch(errorMsg);
    }
}

export = altInstance.createActions<Actions>(ComponentLibraryActions);

Tried it without the this.generateActions(...) too, but no luck...

Any idea whats going wrong here? I can't get this project to run either (gives me an error Error: ENOENT: no such file or directory, open '/Users/rlopezna/dev/alt-typescript-tutorial/typings/references.d.ts'after npm start)...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.