I've worked on converting some of Reacts tutorial to TypeScript just to try it out. Here's some of the code, and it's not 100%. https://gist.github.com/seivan/c01a3b1173cd237b8531
I've worked on converting some of Reacts tutorial to TypeScript just to try it out. Here's some of the code, and it's not 100%. https://gist.github.com/seivan/c01a3b1173cd237b8531
So far I've managed to get to stuff presented on the window, but as soon as you start messing with references to the DOM components, things start to break down.
It's a shame, I really think Typescript and React would be the answer to getting a decent code base.
One of the cool parts, is that you get to define what your property is with static type checking and have no need to use Reacts on PropValidator.
let search = new SearchBox<{ options:SearchOptions, onSearch:OnSearchHandler> })
That tells you that the SearchBox props contains SearchOptions and a delegate to call when searching
I'm just starting with both React and TypeScript, so it could just be me.
No one cares.
Still figuring out the interoperability between React(JS) and TypeScript.
There are some issues regarding arrays from React that don't have Typescript features, even when casted (like filter() and reduce()
Not to mention the lack of JSX makes things verbose.
Anyway, here's a sample code of Facebooks own tutorial. https://gist.github.com/seivan/fad1a175a5e140299fb2
I REALLY love the one-way flow of data.