const output_typescript : type_output = { "render": function (input_data) { return ( input_data["domains"] .map( (domain) => lib_plankton.string.coin( "type type_{{name}} = {\n{{fields}}\n};\nlet collection_{{name}} : {{collection_type}} = {{collection_value}};\n", { "name": domain.name, "fields": ( domain.data_fields .map( (data_field) => lib_plankton.string.coin( "\t{{name}} : {{type}};{{macro_comment}}", { "name": data_field.name, "type": lib_plankton.string.coin( (data_field.nullable ? "(null | {{core}})" : "{{core}}"), { "core": { "boolean": "boolean", "integer": "number", "float": "number", "string_short": "string", "string_medium": "string", "string_long": "string", }[data_field["type"]], } ), "macro_comment": ( (data_field.description !== null) ? lib_plankton.string.coin( " // {{comment}}", { "comment": data_field.description, } ) : "" ), } ) ) // .map(x => ("\t" + x)) .join("\n") ), "collection_type": ( (domain.key_field === null) ? lib_plankton.string.coin( "Array", { "name": domain.name, } ) : lib_plankton.string.coin( "Record", { "name": domain.name, } ) ), "collection_value": ( (domain.key_field === null) ? "[]" : "{}" ), } ) ) .map(x => (x + "\n")) .join("\n") ); }, };