NaturalIntelligence / NaturalIntelligence/fast-xml-builder

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

Open Beginner friendly
#25 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
22
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the exports in fxb.js with the declared exports in fxb.d.ts. Verify the documented default and named import forms with the package build and runtime, then confirm that the intended named XMLBuilder or Builder import works without the eslint warning or a runtime crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.