ursuletzu Posted November 5, 2013 Share Posted November 5, 2013 Hi, I am trying to play with phaser and typescript, and i noticed that it misses js doc comments, which i can see in the js files themselves. Could you please fix this? Latest phaser from github Best Regards Link to comment Share on other sites More sharing options...
rich Posted November 6, 2013 Share Posted November 6, 2013 Not sure how to be honest! We're using an automated script to parse the phaser.js file and create the definitions file, and for some reason it seems to strip the actual jsdoc blocks out. If someone would like to tweak the script to stop doing this, that'd be awesome. This is the one we use: https://github.com/joshheyse/jsdocts Link to comment Share on other sites More sharing options...
Cameron Foale Posted November 6, 2013 Share Posted November 6, 2013 If I'm not mistaken, it should be possible to tweak: https://github.com/joshheyse/jsdocts/blob/master/templates/typescript/module.tmpl to include the description. I don't have the doc compilation set up, but something like the following should at least get return types and descriptions.<for each="module" in="data"><if test="module.name != '{GLOBAL}'">declare module {+module.name+} { </if> <for each="cls" in="module.classes"> export interface {+cls.name+} <if test="cls.inheritsFrom">extends {+ cls.inheritsFrom +} </if> { <if test="cls.properties.length"> <for each="property" in="cls.properties"> <if test="property.isStatic">static </if>{+property.name+}<if test="property.type">: {+property.type+}</if>;</for></if> <if test="cls.methods.length"><for each="method" in="cls.methods"> /** <if test="method.description">* {+ method.description +}</if> <if test="method.returnType">* @type {{+method.returnType+}}</if> */ <if test="method.isStatic">static </if>{+method.name+}{+makeSignature(method.params)+}<if test="method.returnType">: {+method.returnType+}</if>;</for> </if>}</for> <if test="module.name != '{GLOBAL}'"> } </if></for>Note: publish.js would also need to be edited to pass through the description in mapMethod. This could actually do the wrapping and star adding too. Link to comment Share on other sites More sharing options...
ursuletzu Posted November 6, 2013 Author Share Posted November 6, 2013 In the same area, TypeScript,it seems that some definitions are not accurate: a) some method parameters should be marked as optional some methods need overload for example the game constructor.c) Typescript 0,9.1.1 seems to have a big problem that Phaser class is also a module. I had to define a separate PhaserConsts class. Regards Link to comment Share on other sites More sharing options...
rich Posted November 6, 2013 Share Posted November 6, 2013 I'm thinking I'm going to have to write a manual parser. Pah.. another job to do! RestingCoder 1 Link to comment Share on other sites More sharing options...
vulvulune Posted January 14, 2015 Share Posted January 14, 2015 I added the comments in the typescript file definition. You can get the new Phaser.d.ts file in this pull request: https://github.com/photonstorm/phaser/pull/1541 I hope it it will added in the main repository soon. clark 1 Link to comment Share on other sites More sharing options...
vulvulune Posted January 22, 2015 Share Posted January 22, 2015 It is now merged in the dev branch. Thank you photonstorm (https://github.com/photonstorm/phaser/tree/dev) You can download the phaser.comments.d.ts file and the pixi.comments.d.ts file from the typescript folder. Even if you use the last stable release, you can use these new files to help you. clark 1 Link to comment Share on other sites More sharing options...
Recommended Posts