javascript - How to specify a d.ts file for a js file in typescript?
淡淡烟草味
淡淡烟草味 2017-05-19 10:15:32
0
1
466

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?
淡淡烟草味
淡淡烟草味

reply all(1)
PHPzhong

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template