Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to import type XMLBuilder #146

Open
mperdikeas opened this issue Jul 14, 2022 · 2 comments
Open

unable to import type XMLBuilder #146

mperdikeas opened this issue Jul 14, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mperdikeas
Copy link

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:

  • node.js: [4.19.2]
  • xmlbuilder2 [3.0.2]

Additional context
None

@mperdikeas mperdikeas added the bug Something isn't working label Jul 14, 2022
@jkowalleck
Copy link
Contributor

jkowalleck commented Apr 26, 2023

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants