Ionic 2 RC0 3rd party JS lib with own custom typescript definition file



Before Ionic 2 RC0 (beta11), I was handling 3rd party JS lib (numeraljs) by creating my own typescript definition file .d.ts file to expose the library. I didn’t add it as a node_modules as it doesn’t have a typescript declaration.

I copied the numeral.js file into a separate folder and created my own .d.ts file that exposes only the functions that I need.


using the numeral.js I copied from node_module/numeral from another project


export Interface NumeralClass {

export function numeral(value?:any): NumeralClass;

and importing it in another class via

import { numeral } from '../vendor/numeral';

doSomething() {

and it works properly.

But now in RC0, I am encountering the below error

“Could not resolve ‘…/…/vendor/numeral’ from .js” error.
at Error (native)
at …\node_modules\rollup-plugin-node-resolve\dist\rollup-plugin-node-resolve.cjs.js:78:21
at …\node_modules\browser-resolve\index.js:265:24

Is above still supported? If not, what other way can I do this (note that numeraljs is just one of my custom libs so I prefer not to use ‘typings’)



@tiuser4567 Have you found a solution ?


Not sure if this will help you?


If you have bothered to write a d.ts file you are happy with, what I would do is to roll your own minimal @types/numeraljs and use npm link to install it into your project. That way you can use numeraljs naturally via npm as well and don’t have to fool around with vendor directories.