typescriptintellij-ideacode-completionmathjs

Why does code-completion work on Stackblitz, but not in Intellij?


Here is a simple repository to reproduce the issue: https://github.com/tmtron/mathjs-typescript-types

Stackblitz works

Code completion works fine when we open the project in Stackblitz:

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)?


Solution

  • 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: