Skip to content

Type generation crashes when encountering external type references #45

@GSGerritsen

Description

@GSGerritsen

Environment

Node: 22.15.0
capnp-es version: 0.0.11

Reproduction

  1. Create a Cap'n Proto schema that imports types from an external schema
  2. Compile only the importing schema without including the external schema
  3. The compiler crashes with "missing node" error

Describe the bug

The TypeScript code generator throws an error when it encounters references to external types that aren't available in the current compilation context. This happens when a Cap'n Proto schema imports types from other schemas that aren't being compiled in the same invocation.

When the compiler encounters an external type reference (struct, enum, or interface) that isn't in the current node context, it throws an error in lookupNode() with message: "missing node".

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions