search

Home  >  Q&A  >  body text

javascript - How to specify a d.ts file for a js file in typescript?

For example, in electron, we can

var lodash1 = require('./lib/lodash.min')

I want vscode to automatically prompt 'each...method' when lodash1.

Then we have ./typings/lodash/index.d.ts
How to specify this lodash1 variable to use such a index.d.ts Woolen cloth

Notice:

lodash.min.js is just the address in a project, not the npm installed node_modules directory
lodash /index.d.ts is also the address in the project, not the directory installed by npm

Is there any solution?
淡淡烟草味淡淡烟草味2836 days ago473

reply all(1)I'll reply

  • PHPz

    PHPz2017-05-19 10:17:32

    Add a reference at the beginning of the file
    ///<reference path='index.d.ts' />

    That’s probably it. For details, you can check out the typings documentation, it’s very clear

    reply
    0
  • Cancelreply