https://github.com/chnapy/tiled-types
Type definitions of Tiled generated JSON https://github.com/bjorn/tiled
https://github.com/chnapy/tiled-types
tiled-map-editor types typescript
Last synced: 2 months ago
JSON representation
Type definitions of Tiled generated JSON https://github.com/bjorn/tiled
- Host: GitHub
- URL: https://github.com/chnapy/tiled-types
- Owner: Chnapy
- License: mit
- Created: 2020-01-10T21:05:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T14:30:37.000Z (over 2 years ago)
- Last Synced: 2025-04-18T11:15:37.568Z (2 months ago)
- Topics: tiled-map-editor, types, typescript
- Language: TypeScript
- Size: 202 KB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tiled-types
Type definitions of Tiled generated JSON https://github.com/bjorn/tiled.
[](https://travis-ci.com/Chnapy/tiled-types)
Made for Tiled 1.4.
Based on its documentation https://doc.mapeditor.org/en/stable/reference/json-map-format.
## Installation
```
npm install tiled-types
```## Use
```typescript
import TiledMap, { TiledLayerTilelayer } from "tiled-types";// Assume we're in node context
const map: TiledMap = fs.readFileSync('path/to/schema.json', 'utf8');const allTilelayers: TiledLayerTilelayer[] = map.layers
.filter((l): l is TiledLayerTilelayer => l.type === 'tilelayer');
```
You can find quite the same example [here](types/tiled-tests.ts)## Credits
Thanks to [type-zoo](https://github.com/pelotom/type-zoo) for there repo configuration :+1:
And to [Tiled contributors](https://github.com/bjorn/tiled/graphs/contributors) :100: