Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

[BUG] Generating from ndjson file: Cannot read properties of undefined #15

@michaelfuermann-xitaso

Description

@michaelfuermann-xitaso

I created a small definition in a ndjson file for a first test:

{"resourceType": "Questionnaire","meta": {"profile": ["http://hl7.org/fhir/5.0/StructureDefinition/Questionnaire"]},"version": "0.1","name": "QuestionnairePatientComment", "title": "Kommentar senden", "status": "draft", "subjectType": ["Patient"], "item": [{"type": "text", "linkId": "patient_comment", "text": "Gibt es weitere Anliegen, die du mitteilen möchtest?"}]}

Trying to generate types from this NDJSON with
npx @fhirschema/codegen generate -f fhir/test.ndjson -o types -g typescript

leads to the following error:

Starting code generation with typescript generator...
Successfully generated code to test
/mnt/[ ... ]/node_modules/@fhirschema/codegen/dist/loader.js:106
            .filter(({ identifier }) => identifier.kind === 'complex-type')
             ^

TypeError: Cannot read properties of undefined (reading 'filter')
    at SchemaLoader.complexTypes (/mnt/[ ... ]/node_modules/@fhirschema/codegen/dist/loader.js:106:14)
    at /mnt/[ ... ]/node_modules/@fhirschema/codegen/dist/generators/typescript/index.js:231:32
    at TypeScriptGenerator.dir (/mnt/[ ... ]/node_modules/@fhirschema/codegen/dist/generator.js:58:9)
    at TypeScriptGenerator.generate (/mnt/[ ... ]/node_modules/@fhirschema/codegen/dist/generators/typescript/index.js:229:14)
    at Command.<anonymous> (/mnt/[ ... ]/node_modules/@fhirschema/codegen/dist/commands/generate.js:234:31)

Node.js v22.14.0

Environment:
Ubuntu 22 in Windows WSL2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions