Here is an example: I installed axios (npm install axios --save
), and try to import it in a .tsx
file with import axios from 'axios';
This compiles fine with tsc version 2.3.3, no error, no warning. And it works at runtime as well.
But for some reason, Visual Studio 2017 IntelliSense, for which I installed typescript SDK 2.3.3.0, gives the error Cannot find module 'axios'
. It works only if I give him the relative path (in my case, ../../../../node_modules/axios/index
, which is far from practical.
I've read the resolution mechanism used by typescript, and for this case it should find the axios/package.json
file, with a "typings"
entry that indicates ./index.d.ts
. I suppose that's what tsc
does, and why compilation works fine, but IntelliSense has some issue somewhere.
Am I doing something wrong, or is it an IntelliSense bug?
via youen
No comments:
Post a Comment