2021-08-29

Autocomplete for non-TypeScript npm packages doesn't work in PhpStorm

How can I make my TypeScript project in PhpStorm autocomplete npm packages that don't use TypeScript?

I'm using this npm package called steamcommunity and it does not use TypeScript.

As you can see in the first image the autocomplete doesn't work for this package (which is absolutely frustrating for me cause I have to constantly look into the documentation):

autocomplete not working

But when I manually change the index.js file of the package (node_modules/steamcommunity/index.js) to index.ts, the autocomplete suddenly starts working:

autocomplete working

Is there a better solution than to manually modify the file in node_modules?

EDIT: This is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "lib": ["es6"],
    "allowJs": true,
    "outDir": "build",
    "rootDir": "src",
    "strict": true,
    "noImplicitAny": false,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "checkJs": true,
    "strictNullChecks": false
  }
}


from Recent Questions - Stack Overflow https://ift.tt/3sQAyzY
https://ift.tt/38mN5BW

No comments:

Post a Comment