New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect type for Tiled custom properties field in Tilemap and another classes #6331
Comments
Pretty sure this is a recent change in Tiled itself. It didn't use to be an array, so the correct type, to support multiple versions of Tiled, would need to be |
Yes, you right. I asked in Tiled discord about format and how long it was changed. TL;DR The From discord discussion:
"properties":
{
"test":"",
"test2":""
},
"propertytypes":
{
"test":"string",
"test2":"string"
},
How do you think, is it necessary to support outdated format for compatibility? |
Yes we need both formats. Tiled is the kind of app that devs don't often update. |
Indeed the JSON format changed in Tiled 1.2, which I don't expect anybody to use anymore. However, Tiled retains the ability to save maps in the old format even in the latest version, by disabling the "json" plugin and enabling the "json1" plugin instead in Preferences > Plugins. If Phaser has not yet been updated to support the new format, I expect Tiled users have been switching to the "json1" plugin. It would in any case be good to support both formats, to make life easier for both new and existing users. :-) |
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
Version
Description
Tilemap and other entities are working with Tiled map data has incorrect type annotation for
properties
field.https://github.com/photonstorm/phaser/blob/ec18bf6ac77f1ae6e36258d1105b831069984c28/src/tilemaps/Tilemap.js#L191-L198
On Tiled documentation pages the scheme of Map properties field is described as array of properties, not an
object
. This is correct for another Tiled entities, like layer, chunk, objects, etc.Example Test Code
I prepared a little example with simple JSON map exported from Tiled 1.9.2.
https://codesandbox.io/s/cool-surf-vbetsr?file=/scenes/HelloWorldScene.ts
In example we can see that's array's methods don't be allow for
tileset.properties
field.Additional Information
I made some jsdoc types for describe Tiled custom properties and check how it generate in tsgen utility in Phaserjs repository. It generate correct TS types, but I don't so confident for edit existing Tilemap and another classes. if it is useful please feel free to use it.
The text was updated successfully, but these errors were encountered: