0
votes

When using a 3rd party libary installed npm, can I expect Visual Studio Code to provide intellisense for the package even though there is no typings file?

This works in IntelliJ/Webstorm so I think it's possible. However, I cannot tell from the Visual Studio Code documentation whether this is currently supported.

Note: I am looking for intellisense while coding in .ts files, not inside of .html files or elsewhere.

1
See if the library is listed in the @types scoped npm package https://www.npmjs.com/~types. If it is you can simply add types by npm install @types/libraryname. - dotcs
Thank you, I'm aware of how typings work. Unfortunately, many libraries do not have typings files. - jvhang
You're welcome. In this case you should consider writing declaration files for the library. Don't forget to check DefinitelyTyped and typings first. - dotcs

1 Answers

0
votes

However, I cannot tell from the Visual Studio Code documentation whether this is currently supported.

Yes it is. Create a tsconfig.json file with compilerOptions.allowJS set to true.

More : https://code.visualstudio.com/docs/languages/typescript#_mixed-typescript-and-javascript-projects