Here is a simple repository to reproduce the issue: https://github.com/tmtron/mathjs-typescript-types
Code completion works fine when we open the project in Stackblitz:
For some reason, code-completion in IntelliJ (2022.2.3 Ultimate) does not work:
When I Ctrl+Click the MathJsStatic
import symbol, IntelliJ shows 2 options:
And it seems to use the wrong one (defined in node_modules/mathjs/types/index.ts
):
How can we make IntelliJ use the correct types from index.d.ts
(and ignore index.ts
)?
The issue is fixed in version 11.3.1
mathJs Fix #2812
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:
node_modules/types/index.ts
to node_modules/types/main.ts
node_modules/types/index.ts