[SOLVED] Implement angular2-moment errors. How to implement npm modules?

I am trying to implement angular2-moment package

I have done:
sudo npm install --save angular2-moment sudo typings install --save moment

I wrote in terminal ionic serve --lab and got an error:

TypeScript error: /home/matanyed/Development/Geektime/node_modules/angular2-moment/DurationPipe.ts(5,14): Error TS2420: Class 'DurationPipe' incorrectly implements interface 'PipeTransform'.
  Types of property 'transform' are incompatible.
    Type '(value: any, ...args: string[]) => string' is not assignable to type '(value: any, args: any[]) => any'.
      Types of parameters 'args' and 'args' are incompatible.
        Type 'any[]' is not assignable to type 'string'.
TypeScript error: /home/matanyed/Development/Geektime/node_modules/angular2-moment/FromUnixPipe.ts(7,14): Error TS2420: Class 'FromUnixPipe' incorrectly implements interface 'PipeTransform'.
  Types of property 'transform' are incompatible.
    Type '(value: any, ...args: string[]) => any' is not assignable to type '(value: any, args: any[]) => any'.
      Types of parameters 'args' and 'args' are incompatible.
        Type 'any[]' is not assignable to type 'string'.

/home/matanyed/Development/Geektime/node_modules/angular2-moment/TimeAgoPipe.ts:3
import {Pipe, ChangeDetectorRef, PipeTransform, OnDestroy} from 'angular2/core';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

What should I do to use moment.js in my app?

Look here: ParseError: 'import' and 'export' may appear only with 'sourceType: module · Issue #28 · urish/ngx-moment · GitHub

1 Like

Thanks you, it helped me.