Skip to content

XMLBuilder object should be exported as a named export, not just the type #25

Description

@RobertGemmaJr

The Problem

This default import from the documentation gives an eslint warning:

// eslint[import-x/no-named-as-default]: "Using exported name 'XMLBuilder' as identifier for default export."
import XMLBuilder from "fast-xml-builder";

This is because XMLBuilder is also a named export in the package (in fxb.d.ts)

Alternatively, this import will pass eslint and a build but will crash during runtime:

import { XMLBuilder } from "fast-xml-builder";

This is because the named XMLBuilder export is only a type, not the function itself.

The Solution

It would be nice if fxb.js also exported the default function Builder as a named export. Keeping the name as Builder makes sense to me but XMLBuilder is what's currently documented

Activity

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