babelfhir-ts 1.5.13 → 1.5.14

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.
@@ -416,7 +416,7 @@ function generateBundleParser(clientDir, resourceTypes) {
416
416
  const unionType = profiles.map(p => `GeneratedTypes.${p}`).join(' | ');
417
417
  return ` case '${baseType}':
418
418
  return entries
419
- .filter((e): e is BundleEntry<${unionType}> => e.resource?.resourceType === '${baseType}')
419
+ .filter((e): e is BundleEntry<${unionType}> => (e.resource as { resourceType?: string } | undefined)?.resourceType === '${baseType}')
420
420
  .map(e => e.resource!) as T[];`;
421
421
  })
422
422
  .join("\n");
@@ -463,7 +463,7 @@ export class BundleParser {
463
463
  /**
464
464
  * Get resources of a specific type
465
465
  */
466
- getResourcesByType<T extends FhirResource>(resourceType: T['resourceType']): T[] {
466
+ getResourcesByType<T extends FhirResource>(resourceType: string): T[] {
467
467
  const entries = this.getAllEntries();
468
468
  switch (resourceType) {
469
469
  ${parseByTypeCases}
@@ -475,7 +475,7 @@ ${parseByTypeCases}
475
475
  /**
476
476
  * Get the first resource of a specific type
477
477
  */
478
- getFirstResourceByType<T extends FhirResource>(resourceType: T['resourceType']): T | undefined {
478
+ getFirstResourceByType<T extends FhirResource>(resourceType: string): T | undefined {
479
479
  return this.getResourcesByType<T>(resourceType)[0];
480
480
  }
481
481
 
@@ -498,9 +498,9 @@ ${parseByTypeCases}
498
498
  /**
499
499
  * Get entries of a specific resource type
500
500
  */
501
- getEntriesByType<T extends FhirResource>(resourceType: T['resourceType']): BundleEntry<T>[] {
501
+ getEntriesByType<T extends FhirResource>(resourceType: string): BundleEntry<T>[] {
502
502
  return this.getAllEntries().filter(
503
- (e): e is BundleEntry<T> => e.resource?.resourceType === resourceType
503
+ (e): e is BundleEntry<T> => (e.resource as { resourceType?: string } | undefined)?.resourceType === resourceType
504
504
  );
505
505
  }
506
506
 
@@ -539,7 +539,7 @@ ${parseByTypeCases}
539
539
  const grouped = new Map<string, FhirResource[]>();
540
540
 
541
541
  for (const resource of this.getAllResources()) {
542
- const type = resource.resourceType;
542
+ const type = (resource as { resourceType: string }).resourceType;
543
543
  if (!grouped.has(type)) {
544
544
  grouped.set(type, []);
545
545
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babelfhir-ts",
3
- "version": "1.5.13",
3
+ "version": "1.5.14",
4
4
  "description": "BabelFHIR-TS: generate TypeScript interfaces, validators, and helper classes from FHIR R4/R4B/R5 StructureDefinitions (profiles) directly inside package archives.",
5
5
  "type": "module",
6
6
  "main": "out/src/main.js",