2.1.2 • Published 2 years ago
@workadventure/tiled-map-type-guard v2.1.2
Tiled map type guards
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:
ITiledMapITiledMapLayerITiledMapGroupLayerITiledMapImageLayerITiledMapObjectLayerITiledMapObjectITiledMapTextITiledMapPoint
ITiledMapTileLayer
ITiledMapTilesetITiledMapTileITiledMapWangColorITiledMapWangSetITiledMapWangTile
ITiledMapChunkITiledMapFrameITiledMapGridITiledMapOffsetITiledMapPropertyITiledMapTerrainITiledMapTransformations
Usage:
// This will throw an error if "data" is not matching the type ITiledMap
const map: ITiledMap = ITiledMap.parse(data);