Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@workadventure/tiled-map-type-guard

workadventure12.3kMIT2.1.2TypeScript support: included

Typescript package boilerplate template

typescript, tiled, type-guard

readme

Tiled map type guards

Github Actions codecov

When working with Tiled maps, it can be useful to have property defined types in Typescript.

This package contains a set of interfaces that map the Tiled map JSON format.

Moreover, this package comes with Zod type guards that will allow you to actually check that the JSON file ou are reading is actually a well-formed Tiled map.

Available interfaces:

  • ITiledMap
  • ITiledMapLayer
    • ITiledMapGroupLayer
    • ITiledMapImageLayer
    • ITiledMapObjectLayer
      • ITiledMapObject
        • ITiledMapText
        • ITiledMapPoint
    • ITiledMapTileLayer
  • ITiledMapTileset
    • ITiledMapTile
      • ITiledMapWangColor
      • ITiledMapWangSet
      • ITiledMapWangTile
  • ITiledMapChunk
  • ITiledMapFrame
  • ITiledMapGrid
  • ITiledMapOffset
  • ITiledMapProperty
  • ITiledMapTerrain
  • ITiledMapTransformations

Usage:

// This will throw an error if "data" is not matching the type ITiledMap
const map: ITiledMap = ITiledMap.parse(data);

changelog

2.1.2 (2023-10-20)

Bug Fixes

  • Adding support for tilesets that are collections of images (#21) (686bffd)

2.1.1 (2023-03-14)

Bug Fixes

2.1.0 (2023-01-11)

Features

  • Adding support for Tilesets referencing files (0b6114d)

2.0.6 (2022-10-25)

Bug Fixes

2.0.5 (2022-07-07)

Bug Fixes

  • do not create a map copy by default (#16) (83ef71a)

2.0.4 (2022-07-06)

Bug Fixes

  • Exporting the Json type (4b66ea1)

2.0.3 (2022-07-05)

Bug Fixes

  • Fixing gid property in ITiledMapObject to int (#14) (4759b91)

2.0.2 (2022-07-05)

Bug Fixes

2.0.1 (2022-07-05)

Bug Fixes

  • Adding stricter types for properties (#12) (b688a02)

2.0.0 (2022-06-28)

Features

  • release: replace gtg by zod (659bc6b)

BREAKING CHANGES

  • release: Renamed the "type" attribute on tile and object interfaces to "class".

1.0.3 (2021-10-18)

Bug Fixes

  • Fixing a circular dependency in type checking for isITiledMapGroupLayer (f0edc70)

1.0.2 (2021-08-11)

Bug Fixes

  • Fixing animations parsing (bad4a13)
  • Fixing isTiledMapGroupLayer type (0d5e3b7)
  • pointless commit to trigger CI after Github Actions was down (170417d)

1.0.1 (2021-08-10)

Bug Fixes

  • grouplayer: Fixing missing layers property in group layers (b26959e)

1.0.0 (2021-07-16)

Bug Fixes

  • deploy: Triggering CI deployment of previous commits (d3ba712)

1.0.0

First release