You can use React in TypeScript with the type definitions here:
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/react

My team is using React in TSX which references AS libraries typed with
as2dts. For my work, the major advantage AS has over TS is the is/as
operators which can check if something implements a particular interface at
runtime.  Interfaces in TypeScript cannot be referenced at runtime.

You could conceivably build something that directly converts ActionScript
with inline XML into TSX or JSX, but I don't see the value in that since
ActionScript does not have as many strong typing features as TypeScript
has.  A slightly different approach would be to map the MXML life-cycle
onto the React life-cycle so you could build your GUI in MXML rather than
TSX or JSX.  The difference would be if you already know MXML you would not
have to learn or care about the React life-cycle. I haven't thought of how
much work that would be.


On Fri, Jun 3, 2016 at 5:51 PM, Alex Harui <aha...@adobe.com> wrote:

> That's interesting.  So essentially, you could replace all the JS in the
> ReactJS examples with AS?
>
> I still think there are more productivity gains beyond that for ReactJS.
> Anytime I look at these framework APIs using a lot of {} objects, that is
> ripe for a more strongly-typed API surface.
>
> -Alex
>
> On 6/3/16, 2:06 PM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:
>
> >I had an idea recently that I haven't looked into too deeply, so it might
> >turn out that it isn't feasible. However, I'd like to try adding an
> >optional flag to make the compiler interpret XML literals in ActionScript
> >as JSX instead (obviously, you'd no longer be able to use XML literals for
> >their original purpose when you specify this flag). The compiler could
> >generate the appropriate JavaScript calls to React.
> >
> >I think there is some JSX syntax that won't be treated as valid XML, but
> >it
> >might still be useful to have a subset.
> >
> >- Josh
> >
> >On Fri, Jun 3, 2016 at 10:33 AM, Peter Ent <p...@adobe.com> wrote:
> >
> >> Hi,
> >>
> >> FlexJS has a couple of non-Flash component libraries now, CreateJS and
> >> jQuery, along with integration with Apache Cordova. This got me thinking
> >> about ReactJS. I did a little investigation to see how it might fit with
> >> FlexJS and I wrote a brief page about[1]. My opinion is that ReactJS,
> >> especially when used with JSX, is more parallel to FlexJS and not easily
> >> integrated as a project like some of the other JavaScript offerings.
> >>
> >> If you have familiarity with ReactJS, perhaps you could give the
> >>article a
> >> look and provide some feedback. Maybe I missed something crucial about
> >> ReactJS.
> >>
> >> Thanks,
> >> Peter Ent
> >> Adobe Systems/Apache Flex Project
> >>
> >>
> >> [1] https://cwiki.apache.org/confluence/display/FLEX/FlexJS+and+ReactJS
> >>
>
>

Reply via email to