@geoffblair/tiledscript
v0.1.1
Published
Tiled map editor interfaces and utilities for TypeScript.
Downloads
5
Readme
TiledScript
Tiled map editor interfaces and utilities for use in TypeScript or JavaScript projects.
Features
- TypeScript interfaces, types, etc for the Tiled JSON format
- Utility functions for interacting with Tiled data
- Generate TypeScript declarations from Custom Types
Install
yarn add @geoffblair/tiledscript
Generate Custom Types
Generate TypeScript type declarations from Tiled custom types.
Custom Types are stored within a Tiled Project file.
To generate types, run the following command:
tiled-gen-types path/to/example.tiled-project src/types.ts
For example, the following custom type from a project file:
{
"propertyTypes": [
{
"id": 1,
"name": "Example",
"type": "class",
"members": [
{
"name": "elapsed",
"type": "int",
"value": 0
},
{
"name": "state",
"type": "bool",
"value": false
},
{
"name": "type",
"type": "string",
"value": ""
}
],
"color": "#ffa0a0a4",
"drawFill": true,
"useAs": ["property"]
}
]
}
Would result in the following TypeScript declaration:
export interface Example {
elapsed: number;
state: boolean;
type: string;
}