Port remaining lib/data modules to TypeScript

This commit is contained in:
Hornwitser committed 2023-08-11 01:13:38 +02:00
1 parent 2a52a82fb7
commit 679c00527f
6 files changed
+156 -227

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { Type, Static } from "@sinclair/typebox";
/**
* Export manifest for a mod pack
*
* Tracks files stored on disk for data that extracted from Factorio using a
* given mod pack.
*/
export default class ExportManifest {
constructor(
/**
* Mapping between known assets and their file names.
*
* Currently exported assets are
* - settings: JSON of mod settings prototypes.
* - prototypes: JSON of all game prototypes except settings.
* - item-spritesheet: PNG containing icons from the game.
* - item-metadata: JSON of Map entries describing icons in item-spritesheet
* - locale: JSON of flattened Map entries of en locale strings from the game.
*/
public assets: Record<string, string>
) {
if (assets) { this.assets = assets; }
}
static jsonSchema = Type.Object({
"assets": Type.Record(Type.String(), Type.String()),
});
static fromJSON(json: Static<typeof ExportManifest.jsonSchema>) {
return new this(json.assets);
}
}