Type declarations don't match runtime export · Issue #5 · NaturalIntelligence/fast-xml-builder · GitHub
Skip to content

Type declarations don't match runtime export #5

Closed

Description

@macieklamberski

Hi there! While wanting to migrate to the new split parser/builder packages, I've noticed inconsistency in the type definitions.

This makes it impossible to import correctly - named import type-checks but crashes at runtime, default import works at runtime but fails type-checking.

The fix would be to choose either named or default export and use in both places. Happy to submit a PR for whichever direction you prefer.

Activity

  1. timtucker-dte commented on Mar 3, 2026

    @timtucker-dte

    Personal preference here would be for named exports -- that makes transition a drop-in replacement and also accounts for needing to use named imports when importing the type for XmlBuilderOptions

  2. fredericbahr commented on Mar 4, 2026

    @fredericbahr

    This currently blocks me implementing my desired use-case. If help is needed, im happy to support.

  3. lenovouser commented on Jun 2, 2026

    @lenovouser
    import { Builder } from 'fast-xml-builder';
             ^
    SyntaxError: The requested module 'fast-xml-builder' does not provide an export named 'Builder'
        at #asyncInstantiate (node:internal/modules/esm/module_job:327:21)
        at async ModuleJob.run (node:internal/modules/esm/module_job:431:5)
        at async node:internal/modules/esm/loader:633:26
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
    
  4. amitguptagwl commented on Jun 2, 2026

    @amitguptagwl
    Member

    @lenovouser Try this

    import XMLBuilder from 'fast-xml-builder';
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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