Skip to content
Advertisement

Using import inside lib.d.ts for intellisense in Visual Studio Code

I have a set of custom global variables in my JavaScript project and I want to use VSCode intellisense to help me with auto completion like this:

auto completion for lol

After some googling I found a way to use lib.d.ts in the same directory as the script. If lib.d.ts doesn’t refer other files like this:

JavaScript

everything works fine. But when I try to move Lol class into a separate file the intellisense refuses to show the lol variable in my script file:

JavaScript
JavaScript

Is there a way to fix this?

Advertisement

Answer

I think I found an answer. Despite scripts (declare style) can pollute global scope and can’t use import, modules can do both. Instead of using declare I switched to export global like this:

JavaScript
Advertisement