On 3/15/16, 3:16 PM, "Andy Dufilie" <[email protected]> wrote:
>I'm using as2dts in my own project [5] because we're writing all the GUI >in >TypeScript/React (which I highly recommend looking into) but using an AS >core [6] via FlexJS and it would be a nightmare to develop things without >strong typing information. I just took a quick look at React. What is it you like about it? If it is the actual UI library itself, I would have to wonder what it would take to wrap up their UI Library so it could be used in MXML. The JSX I saw seemed to have a lot of non-XML around it. > >An interesting note is that TypeScript allows templating like >Array<MyClass>, so I've added a way in as2dts to support that. It handles >comments surrounded by /*/../*/ to denote TS typings and/or template info >inline in your AS code. For example [7][8]: > >public static function getDescendants/*/<T>/*/(object:ILinkableObject, >filter:/*/new(..._:any[])=>T | string/*/Class = null):Array/*/<T & >ILinkableObject>/*/ > >becomes > >static getDescendants<T>(object: ILinkableObject, filter?: new (..._: >any[]) >=> T | string): Array<T & ILinkableObject>; > >TS does type inference, so if you create a variable like this (using the >AS >class Weave): >var result = Weave.getDescendants(root, MyClass); >the compiler will now know that result is of type MyClass[], without >having >to specify it like var result:MyClass[]. If FlexJS becomes popular, I'm sure we'll end up having to support templates some day. Volunteers are welcome to start now. -Alex
