Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/workadventure/tiled-map-type-guard
A Typescript package containing types for loading a Tiled JSON map, along appropriate type guards
https://github.com/workadventure/tiled-map-type-guard
Last synced: about 2 months ago
JSON representation
A Typescript package containing types for loading a Tiled JSON map, along appropriate type guards
- Host: GitHub
- URL: https://github.com/workadventure/tiled-map-type-guard
- Owner: workadventure
- Created: 2021-07-16T12:13:52.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-20T11:28:02.000Z (about 1 year ago)
- Last Synced: 2024-09-20T04:20:02.263Z (4 months ago)
- Language: TypeScript
- Size: 494 KB
- Stars: 10
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Tiled map type guards
![Github Actions](https://github.com/workadventure/tiled-map-type-guard/workflows/Release/badge.svg) [![codecov](https://codecov.io/gh/workadventure/tiled-map-type-guard/branch/main/graph/badge.svg?token=UCCA6D6JCB)](https://codecov.io/gh/workadventure/tiled-map-type-guard)
When working with [Tiled](https://www.mapeditor.org/) 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](https://doc.mapeditor.org/en/stable/reference/json-map-format/).
Moreover, this package comes with [Zod type guards](https://github.com/colinhacks/zod) 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:
```ts
// This will throw an error if "data" is not matching the type ITiledMap
const map: ITiledMap = ITiledMap.parse(data);
```