1

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

TmTron
  • 17,012
  • 10
  • 94
  • 142
  • In `node_modules/mathjs/types/index.ts` right-click menu, choose **Override file type > plain text** - does it help? – lena Oct 11 '22 at 16:49
  • @Lena then ctrl-click works (i.e. takes me to `index.d.ts`), but code-completion still does not work (even after Invalidate-Caches and restarting the IDE). I found out however, that everything works, when I completely delete the `index.ts` file. – TmTron Oct 12 '22 at 07:17

1 Answers1

0

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
TmTron
  • 17,012
  • 10
  • 94
  • 142