oozcitak / xmlbuilder2

An XML builder for node.js
362 stars 35 forks source link

unable to import type XMLBuilder #146

Open mperdikeas opened 2 years ago

mperdikeas commented 2 years ago

Describe the bug

I am using xmlbuilder2 in Node writing my code in TypeScript. I am unsure what is the recommended / idiomatic way to import the type XMLBuilder which is defined in node_modules/xmlbuilder2/lib/interfaces.d.ts

To Reproduce Currently I am doing this:

import {XMLBuilder} from 'xmlbuilder2/lib/interfaces';

This is working but it feels odd.

Expected behavior

I was expecting something more streamlined like:

import {XMLBuilder} from 'xmlbuilder2';

Version:

Additional context None

jkowalleck commented 1 year ago

xmlbuilder2/lib/interfaces appears to be not public API, as it is not reachable from entry point. Furthermore, it is a type, so you should use import type {XMLBuilder} from 'xmlbuilder2/lib/interfaces';

You might use import XMLBuilder from 'xmlbuilder2' to get the public API accessible, which is properly typed.

will-path commented 5 months ago

Seconding this. It would be nice if xmlbuilder2 exported its types.