Jump to content

Typescript Definition Queries.


clark
 Share

Recommended Posts

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 be

constructor(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 :D

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...