-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Feature Request: TypeScript Type Definitions
Summary
The saxonjs-he package currently lacks TypeScript type definitions, which causes type errors when using the library in TypeScript projects.
Current Error
Could not find a declaration file for module 'saxonjs-he'.
'/node_modules/.bun/saxonjs-he@3.0.0-beta2/node_modules/saxonjs-he/SaxonJS3N.js'
implicitly has an 'any' type.
Try `npm i --save-dev @types/saxonjs-he` if it exists or add a new declaration
(.d.ts) file containing `declare module 'saxonjs-he';` [ts(7016)]Use Case
We're building a universal XML ↔ JSON transformer package (xmlt) that relies on Saxon-JS for XSLT transformations. TypeScript type definitions would:
- Improve developer experience - Enable IDE autocompletion and inline documentation
- Catch errors at compile time - Detect incorrect API usage before runtime
- Better integration - Seamless integration with TypeScript projects without type workarounds
- Self-documenting API - Types serve as living documentation
Example Usage
import SaxonJS from 'saxonjs-he';
// Would love to have proper types here!
const result = await SaxonJS.transform({
stylesheetInternal: compiledStylesheet,
sourceText: xmlString,
destination: 'serialized'
}, 'async');Proposed Solution
Options for adding TypeScript support:
- Include .d.ts files in the package - Ship type definitions alongside the JavaScript code
- Publish @types/saxonjs-he - Create a DefinitelyTyped package
- Rewrite in TypeScript - Full TypeScript rewrite (most comprehensive but requires more effort)
Workaround
Currently using:
// Temporary workaround - loses all type safety
declare module 'saxonjs-he';Additional Context
- Package:
saxonjs-he@3.0.0-beta2 - Node.js: v24.10.0
- TypeScript: Latest
- Project: Open-source universal XSLT transformer
Saxon-JS is an excellent XSLT processor, and TypeScript definitions would make it even better for modern JavaScript/TypeScript development! 🚀
Would the team be open to adding TypeScript support? Happy to contribute if guidance is provided.
Metadata
Metadata
Assignees
Labels
No labels