enum-data-contract.ejs 391 B

123456789101112
  1. <%
  2. const { contract, utils, config } = it;
  3. const { formatDescription, require, _ } = utils;
  4. const { name, $content } = contract;
  5. %>
  6. <% if (config.generateUnionEnums) { %>
  7. export type <%~ name %> = <%~ _.map($content, ({ value }) => value).join(" | ") %>
  8. <% } else { %>
  9. export enum <%~ name %> {
  10. <%~ _.map($content, ({ key, value }) => `${key} = ${value}`).join(",\n") %>
  11. }
  12. <% } %>