| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- export const TEMPLATE_HEADER =
- "/** Generated file, do not edit. See scripts/factorio-dump/lua-api/index.ts for generator. */";
- export const FULL_API_TEMPLATE = `${TEMPLATE_HEADER}
- /**
- * Application: {{app}}
- * Version: {{appVersion}}
- * API Version: {{apiVersion}}
- */
- {{#interfaces}}
- {{#if description}}
- /** {{{description}}} */
- {{/if}}
- {{#unless props.length}}
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
- {{/unless}}
- {{#if export}}export {{/if}}interface {{#if extends}}_{{/if}}{{name}} {
- {{#if typeName}}
- type: '{{typeName}}';
- {{/if}}
- {{#props}}
- {{#if description}}
- /** {{{description}}} */
- {{/if}}
- {{name}}{{#if optional}}?{{/if}}: {{{type}}};
- {{/props}}
- }
- {{#if extends}}
- export type {{name}} = _{{name}} & Omit<{{extends}}, keyof _{{name}}>;
- {{/if}}
- {{#if isTypeFunction}}
- export function is{{name}}(value: unknown): value is {{name}} {
- return (value as { type: string }).type === '{{isTypeFunction}}';
- }
- {{/if}}
- {{/interfaces}}
- {{#types}}
- {{#if description}}
- /** {{{description}}} */
- {{/if}}
- export type {{name}} = {{{value}}};
- {{/types}}
- type SR<T> = Record<string, T>;
- export type FactorioRawData = {
- {{#interfaces}}
- {{#if typeName}}
- "{{typeName}}"?:SR<{{name}}>;
- {{/if}}
- {{/interfaces}}
- }
- `;
|