简体   繁体   中英

Can I add in js reference to an online .d.ts file?

We have an js library that is online (pure javascript file), and we would like to add reference to .d.ts, so the user to able to use the .d.ts without downloading or installing anything. The goal is user to have Intellisence in VS Code for that library.

You can do that by using Triple-Slash directive references.

Just add this line in top of your file.

/// <reference path="./path/to/myTypes.d.ts" />

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