@atomic-ehr/codegen 0.0.2-canary.20251114133113.0a35a8a → 0.0.2-canary.20251117083918.dd4cd72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5802,6 +5802,9 @@ var tsGet = (object, tsFieldName2) => {
5802
5802
  if (tsFieldName2.startsWith('"')) return `${object}[${tsFieldName2}]`;
5803
5803
  return `${object}.${tsFieldName2}`;
5804
5804
  };
5805
+ var tsEnumType = (enumValues) => {
5806
+ return `(${enumValues.map((e) => `"${e}"`).join(" | ")})`;
5807
+ };
5805
5808
  var TypeScript = class extends Writer {
5806
5809
  tsImportType(tsPackageName, ...entities) {
5807
5810
  this.lineSM(`import type { ${entities.join(", ")} } from "${tsPackageName}"`);
@@ -5889,6 +5892,10 @@ var TypeScript = class extends Writer {
5889
5892
  let extendsClause;
5890
5893
  if (schema.base) extendsClause = `extends ${canonicalToName2(schema.base.url)}`;
5891
5894
  this.debugComment(schema.identifier);
5895
+ if (!schema.fields && !extendsClause && !isResourceTypeSchema(schema)) {
5896
+ this.lineSM(`export type ${name} = object`);
5897
+ return;
5898
+ }
5892
5899
  this.curlyBlock(["export", "interface", name, extendsClause], () => {
5893
5900
  if (isResourceTypeSchema(schema)) {
5894
5901
  const possibleResourceTypes = [schema.identifier];
@@ -5906,7 +5913,7 @@ var TypeScript = class extends Writer {
5906
5913
  const tsName = tsFieldName(fieldName);
5907
5914
  let tsType;
5908
5915
  if (field.enum) {
5909
- tsType = field.enum.map((e) => `"${e}"`).join(" | ");
5916
+ tsType = tsEnumType(field.enum);
5910
5917
  } else if (schema.identifier.name === "Reference" && tsName === "reference") {
5911
5918
  tsType = "`${T}/${string}`";
5912
5919
  } else if (field.reference && field.reference.length > 0) {
@@ -5950,7 +5957,7 @@ var TypeScript = class extends Writer {
5950
5957
  const tsName2 = tsFieldName(fieldName);
5951
5958
  let tsType;
5952
5959
  if (field.enum) {
5953
- tsType = `(${field.enum.map((e) => `'${e}'`).join(" | ")})`;
5960
+ tsType = tsEnumType(field.enum);
5954
5961
  } else if (field.reference && field.reference.length > 0) {
5955
5962
  const specialization = tsIndex.findLastSpecialization(flatProfile);
5956
5963
  if (!isSpecializationTypeSchema(specialization))