shearerbeard / alt-typescript-tutorial Goto Github PK
View Code? Open in Web Editor NEWA simple flux tutorial built in typescript with alt and react
A simple flux tutorial built in typescript with alt and react
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.
Can you please help me in resolving this.
Your recruitment will be grateful.
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)...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.