clark Posted February 12, 2014 Share Posted February 12, 2014 I am finding that the TypeScript definition file is somewhat outdated and/or methods do not exist any more. I am adhering to the docs. These questions are just general not bugs but how I can fix them when I find them.Question 1!Does Phaser.Sprite extend anything? http://docs.phaser.io/Sprite.js.html search for "alpha". How come that property does not exist? Question 2!Internal functions. Should these be hidden from the TypeScript Definition File?Example:preUpdate(): void;Question 3!Should Key be * ?Example:constructor(game: Phaser.Game, x?: number, y?: number, key?: string, frame?: number);should beconstructor(game: Phaser.Game, x?: number, y?: number, key?: any, frame?: any);EDITED:Should I Overload instead? For example, In the Phaser.Game the constructor uses a either a string or a HTMLElement object according to the docs. Therefore is it OK to overload in the definition. Instead of Any: Note that this works, when I mouse over the super() of my Game extends Phaser.Game, I see the first contructor followed by (+1 overload) in intellisense. But I do not know if its best practice?constructor(width?: number, height?: number, renderer?: number, parent?: string, state?: Object, transparent?: boolean, antialias?: boolean);constructor(width?: number, height?: number, renderer?: number, parent?: HTMLElement, state?: Object, transparent?: boolean, antialias?: boolean);Question 4!Is there a way to set read only methods? I tried get blah() but the definition hated it. So stuck with public properties?Question 5!I just wondered, is there any way in TypeScript to link code comments to Intellisense in Visual Studio? Like, I see AutoComplete, but it would be cool to see the API comments, Like Flash Builder. Really great work on the documentation.Thanks Feel free to correct me. Looking through the source and docs is really helping me understand things. Any tips I can get on TypeScript are welcome. Link to comment Share on other sites More sharing options...
clark Posted February 12, 2014 Author Share Posted February 12, 2014 Question 5 = Yes, but properties appear to be not supported. And there is very little to no information about what flavour of JSDocs TypeScript support. For now, I will skip commenting. Link to comment Share on other sites More sharing options...
rich Posted February 12, 2014 Share Posted February 12, 2014 TypeScript.. bane of my life Honestly I think the only way lots of these will be fixed is if more community members help patch the defs file (and thank you SO MUCH to the ones that have been doing so!) If you want to get involved, do so on the 1.2 branch. Link to comment Share on other sites More sharing options...
clark Posted February 12, 2014 Author Share Posted February 12, 2014 I have been trawling through it for a few nights cleaning it up. I miss interpreted the staggering size of the library lol... Everything down to Physics is alphabtical order and Api reviewed. I will submit it in a few days when complete Link to comment Share on other sites More sharing options...
rich Posted February 13, 2014 Share Posted February 13, 2014 Nice, I think a lot of people will thank you Link to comment Share on other sites More sharing options...
Recommended Posts