oozcitak / xmlbuilder2

An XML builder for node.js
366 stars 36 forks source link

Can't import type in Nestjs project #4

Closed vschoener closed 4 years ago

vschoener commented 4 years ago

Describe the bug I tried to import the type from this package and I can't get the type properly. So I don't know if it's a tsconfig issue from my side or yours, but til now, it's the first time I get this unresolved type.

Any idea?

image

To Reproduce From an existing TS project:

import { create }  from 'xmlbuilder2';

Try to get the autocomplete inside the brackets and see if you get definitions.

Expected behavior Having my IDE giving the available types

Version:

Additional context

oozcitak commented 4 years ago

I tested importing xmlbuilder2 1.4.1 in an empty folder and I get VS Code intellisense fine:

test-import

I then tested importing xmlbuilder2 1.4.1 into the NestJS starter project and it also works:

test-nestjs

I think this is something on your end.

vschoener commented 4 years ago

Thanks @oozcitak for your time.

Damn, no idea why it doesn't work. I use Webstorm but it should not make this difference. The compilation and the app was working, so it's was good and as I can put the Type in my service, I had the completion from there, but not in the provider I tried to create.

I'll try again, reinstalling the project and restarting IDE.

vschoener commented 4 years ago

So yeah I confirmed from another computer, with fresh install of the project I don't get the completion with webstorm :( but it does with vscode

I know there are sometimes differences between vscode and webstorm to get information, I'll dig a bit see if I can find something

vschoener commented 4 years ago

Maybe it's due to the fact that other project put the index.d.ts in the root of the package and have also tsconfig giving the location of the other definition?

image

image

Just saying it might be related, see winston project https://github.com/winstonjs/winston

oozcitak commented 4 years ago

I confirmed that there is no intellisense with WebStorm.

Maybe it's due to the fact that other project put the index.d.ts in the root of the package and have also tsconfig giving the location of the other definition?

This appears to be the case, I'm adding an explicit types path to package.json. Thank you for investigating.