JSDoc: integer type replaced by number
Closed this issue · 1 comments
Hello,
I'm using Phaser with Haxe (it's a statically typed language that compiles to Javascript (and potentially other languages)). I made a script to generate Haxe bindings with Phaser source code (using jsdoc). It's possible thanks to the jsdoc hints of each methods / attributes. (It's awesome that all methods / attributes has a jsdoc associated)
When I tried to generate 3.50 bindings, I had an issue, because all integer types has been changed to number type. In Haxe, Int type is different than the Float type (unlike in Javascript), so this information was important for me. I saw this commit 02c34cd so this change is intentional.
As this change is intentional, I can't say this is a bug and it should be changed, but I created this issue, first to ask why this change have been made ?
And second, I wanted to signal that this "feature" (precise if a number is a integer or not in jsdoc) was useful, at least for me. So, of course, if it has downsides, it's normal to delete it, but if not, I would be happy if this feature "come back" in Phaser 4 ;-).
Have a nice day, and thank you for Phaser !
I changed them all to number
because integer
isn't a valid data-type in JSDoc / JavaScript / TypeScript, which are of course our primary dev targets.
It could possibly come back in v4, but we'd have to use a custom type to enforce it, as TypeScript (which we're building v4 in) doesn't support integer natively, so you have to 'hack' it in via something like export type Int = number & { __int__: void };
which is a bit of a pain tbh.