#### Signup for the Ionic Newsletter to get the latest news and updates!

• Jonathan Dart

It would be nice if you explained how to use a js lib when no definitions are available.

• Mike Hartington

Of course, this is possible to. For the most part, you can just declare your module inline.

https://github.com/Microsoft/TypeScript/issues/6615

This issue covers all the details of how you would do this.

• http://matheo.co Mateo Tibaquirá Palacios

Any available docs to read tips and learn how to build definitions for my Ionic 2 project? TIA 🙂

• http://weblogs.asp.net/soever Serge van den Oever

import {MyComponent} from ‘./MyComponent’; // ERROR: Cannot find module ‘./MyComponent’
const MyComponent = require(‘./MyComponent’); // Warning if used as – see https://codereviewvideos.com/blog/warning-react-createelement/
const X = require(‘./MyComponent’); // OK if used as
const MyComponent = require(‘./MyComponent’).MyComponent; // OK
const MyComponent = require(‘./MyComponent’).default; // OK if defined as export default class MyComponent
const {MyComponent} = require(‘./MyComponent’); // OK, note that it is also possible to destructure multiple components

For details on how to specify types for desctructured object parameters see https://blog.mariusschulz.com/2015/11/13/typing-destructured-object-parameters-in-typescript.

• Thomas Bernard

What if I want to use this kind of javascript lib (with no definitions but dependencies): https://github.com/ESTOS/gowebrtc.js into an ionic 2 project? What is the easy way to do it?
with ionic 1 it was quite easy but with ionic 2 it seems to be a complete nightmare…

• KelviROLEX

pls i have been trying to install cordova-plugin-themeablebrowser, i have been able to install it using this command cordova plugin add cordova-plugin-themeablebrowser but i really don’t know how to import it to my typescript file… Please can anybody help me?

• Mike Hartington

This really isn’t the place for this. You might want to post in the forum

• sameera207

Hi, Thanks for the great post, Unfortunately I’m getting an error when trying to load lodash library.

I’ve installed the typings and used typings to install lodash ([email protected]). Strange thing is I’m not getting any errors in the compile type. (type script works fine). But when I access the lodash variable , it says

ionic \$ Error: Cannot find module ‘lodash’ from

Following is my ts file

import * as lodash from ‘lodash’;

and Im accessing lodash inside one of my methods

updateOptions(nodeName){
let a = lodash.find(HashArray, function(e: any){
return e.Name == nodeName;
})
}

Any help would be much appreciated, TIA

cheers

Sam

• Domenico Maisano

Good tutorial, this was much needed on a current project that I am working on. On an off related note does anyone know the name of the terminal used in the video posted above?

• Darragh Flynn

This tutorial is very clear, and works perfectly for getting the lodash code completion and to eradicate errors in my IDE. However, when I run gulp build, I get a TS error that it cannot find the lodash module. I’m using the latest Ionic 2 version and everything but to no avail.

• Holly

Yeah I am also having the same issue! On beta.32

I’d like to point out the way typings is currently being done is different. Ionic has since moved away from using “typings install … ” to “npm install @types/lodash –save-dev –save-exact”

• http://matheo.co Mateo Tibaquirá Palacios

Need further documentation to get this use of @types

• X4V1

Thank you !
Do you know where I could find some documentation about that ? The procedure explained here is not working… But with @types/lodash works nice 🙂

• shikhar bansal

I wanted to use mathjax library in ionic 2. I installed it via npm and then installed its typings via typings.But it doesn’t work! There is a line in the typings file declare var MathJax:jax.IMathJax;. I don’t know what to do.

• Reagan Cooper

Is this still necessary? Could the team perhaps add the new method at the top in an EDIT ?

• Pete

I think Typings is a nightmare to use