@geoffblair/tiledscript
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

TiledScript

Build

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

Install via Yarn or npm:

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;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @geoffblair/tiledscript

Weekly Downloads

1

Version

0.1.1

License

ISC

Unpacked Size

8.12 kB

Total Files

11

Last publish

Collaborators

  • geoffblair