简体   繁体   中英

visual studio code intellisense is not working for dojo amd code

I have an app.js file which has dojo amd pattern code as follows:

require(["dojo/dom", ..], function(dom){
  dom.byId('someId').innerHTML = "test";
});

And using tsd, I have installed dojo.d.ts

And also created jsconfig.json file:

{
  "compilerOptions": {
  "target": "ES6",
    "module": "commonjs"
  }
}

But the intellisense is not working. Am I doing anything wrong?

Am I doing anything wrong

Yes. require(["dojo/dom", ..], function(dom){ the variable dom will have an inferred type of any .

Fix

Use import/require and compile with --module amd : http://basarat.gitbooks.io/typescript/content/docs/project/modules.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM