Home > Software engineering >  Why does code-completion work on Stackblitz, but not in Intellij?
Why does code-completion work on Stackblitz, but not in Intellij?

Time:10-22

Here is a simple repository to reproduce the issue: enter image description here

IntelliJ does not work

For some reason, code-completion in IntelliJ (2022.2.3 Ultimate) does not work:

enter image description here

When I Ctrl Click the MathJsStatic import symbol, IntelliJ shows 2 options:

enter image description here

And it seems to use the wrong one (defined in node_modules/mathjs/types/index.ts):

enter image description here

Question

How can we make IntelliJ use the correct types from index.d.ts (and ignore index.ts)?

CodePudding user response:

Update

The issue is fixed in version 11.3.1 mathJs Fix #2812

Original

I think the issue is that the library contains an index.ts file and an index.d.ts file which are not related and this should be fixed by the library authors: see this discussion

Workarounds for now:

  • rename node_modules/types/index.ts to node_modules/types/main.ts
  • or delete node_modules/types/index.ts
  • Related