Here's my understanding of this topic. TypeScript needed strong typing, and DefinitelyTyped become the home for TypeScript definitions for a library. Those definitions are not directly usable by FlexJS. Josh has a dts2as utility that can do the conversion.
Google doesn't need TypeScript definitions. They want plain JS definitions. So they created the externs JSDoc annotations and file format, which looks a lot like original JS source code, but isn't. For example, Externs JS files can't have method bodies that do more than just return null. Third-parties do not always write their code in a Google Closure compatible way. The actual CreateJS source, for example, uses objects with functions instead of the Google Closure "className.prototype" format. So sometimes, a Google Closure Externs (and a DefinitelyTyped offering) needs to be manually generated. And many times, the externs and d.ts files are generated by a community member who wants to use the library and not by the library developers themselves. We've recently provided a way to, instead of using Externs JSDoc or d.ts files, write AS class definitions and generate a typedefs SWC from that. It is so recent, that no library in flex-typedefs uses that, especially since externs files already exist for the libraries in flex-typedefs. A typedefs SWC contains a library.swf with the compiled AS definitions, and a pile of JS files that are the Externs JSDoc-formatted JS files for the Google Closure Compiler. FlexJS has an ExternsCompiler (externc) that takes Externs JSDoc and generates AS files. Compc can then create a typedefs SWC from those AS files. And recently we taught CompC to annotate the pile of JS files with Externs JSDoc and package them the right way. HTH, -Alex On 3/24/17, 2:49 AM, "OK" <p...@olafkrueger.net> wrote: >harbs wrote >> The compiler knows how to read Google Complier extern files. Most of the >> typedefs are created from those. >> >> There’s actually a two-step process for generating the typedefs. It >>first >> creates ActionScript stubs, and then generates the swc from that. It >> download the extern files as part of the build process. >> >> If you are starting from scratch, it’s definitely possible to generate >>the >> swcs from ActionScript stubs, but since most of the typedefs we need >>have >> Google extern files, that’s not necessary. >> >> HTH, >> Harbs > >Ok, I got it! Thanks, Harbs! >But I still wonder why the Angular guys don't follow this path? Instead of >extending their own externs lib they introduced the DefinitelyTyped lib? >It seems to me that the closure lib just contains a handful externs while >DefinitelyTyped covers nearly anything. >But isn't it a very tough work to create all the DefinitelyTyped stuff >manually even if it's done by thousands of contributors? >I understand that if the origin JS code uses the "externs JSDoc >annotations" >then you get the typedefs for free? > > >Thanks, >Olaf > > > > > >-- >View this message in context: >https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle >x-development.2333347.n4.nabble.com%2FFlexJS-How-typedefs-working-was-Acce >ssing-the-DOM-tp60735p60738.html&data=02%7C01%7C%7Cf4274a33335b4224127f08d >4729c2f56%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636259462518631945& >sdata=Stj4D7rNGd36bqe5m6Yv2LJIDq2NnCJWFhP31SV6lw8%3D&reserved=0 >Sent from the Apache Flex Development mailing list archive at Nabble.com.