简体   繁体   中英

Typescript: How to use bowser typings?

I'm updating an AngularJS project to Typescript using Webpack.

Because we are using bowser in our codebase I installed and referenced the related typings.

But still after done this the compiler keeps complaining that the bowser name is unknown.

Does someone know how to effectively use the bowser typings? It worked out of the box for the other libraries.

In a separate *.d.ts file (I have one for miscellaneous shims since so many typings are terrible), you need to add this line:

declare var bowser: BowserModule.IBowser;

For some reason the typing currently doesn't include the actual instantiated object.

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