How typescript uses the js library

cutting edge

Another use of typings is that ts files of third-party js libraries can be generated in the ts library.

In the example of this article, the base64 JS library is referenced in ionic2.

1. Install typings

Install typings globally using npm: npm install -g typings


Successful installation.

Second, search resources, support fuzzy search : typings search base64


3. Install the ts library: typings install base-64 --save


There are many searched here, you can choose at will.

Fourth, install the js library, otherwise it will not work: npm install base-64 --save Note that the names of these two files must be the same


5. Engineering references.

Perform the above steps to automatically generate the typings folder in the project


Process reference:



Reference for the content of this article: http://www.cnblogs.com/cjxhd/p/5777203.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325516786&siteId=291194637