All contributions

NaturalIntelligence/fast-xml-parser

fast-xml-parser

A fast XML parser, validator and builder for JavaScript that works without C or C++ based libraries and without callbacks.

Language
JavaScript
GitHub stars
3,143
Merged changes
1
Project site
naturalintelligence.github.io

What we changed

The CommonJS type declaration (lib/fxp.d.cts) gained the endIndex field on XMLMetaData that the main declaration in src/fxp.d.ts already had.

What this work shows

  • TypeScript type declarations
  • Dual ESM and CommonJS npm packages
What was broken

endIndex was missing for CommonJS

The XMLMetaData interface in src/fxp.d.ts had an endIndex field, the position where an XML node ends in the input, but lib/fxp.d.cts did not. CommonJS code that read endIndex got a type error.

How we fixed it

The same field in both declarations

We added endIndex to lib/fxp.d.cts with the same type and doc comment as in src/fxp.d.ts, so both variants of the package describe node metadata the same way.

#896

Merged change

1 27 October 2026

What it taught us

We make sure an npm package shipped for both ESM and CommonJS has matching type declarations in both variants, because code that loads it with require() relies on the .d.cts file.

More about this technology: TypeScript, React and Node

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.