Type definitions of Tiled generated JSON https://github.com/bjorn/tiled.
Made for Tiled 1.4.
Based on its documentation https://doc.mapeditor.org/en/stable/reference/json-map-format.
npm install tiled-types
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
Thanks to type-zoo for there repo configuration 👍
And to Tiled contributors 💯