Function calls are not supported in decorators but '' was called

I have created an Ionic 5 Angular 10 project and I am importing some animations as I have done for previous projects.

However I am getting the error below. Any ideas what is causing this?
Similar code works fire with another Ionic 5 Angular 9 project I created.

Is this an Angular 10 issue or a typescript issue?

> Error during template compile of ‘AppComponent’ Function calls are
> not supported in decorators but ‘slideInLeftOnEnterAnimation’ was
> called

    import { slideInLeftOnEnterAnimation } from 'angular-animations';

    @Component({
      selector: 'app-root',
      templateUrl: 'app.component.html',
      styleUrls: ['app.component.scss'],
      animations: [
        slideInLeftOnEnterAnimation()
      ]
    })
   Ionic CLI                     : 6.11.11
   Ionic Framework               : @ionic/angular 5.3.5
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3

I’m sort of surprised this ever worked, at least in an AOT context. What is this “angular-animations” thing, and can it be replaced by @angular/animations as described here?

angular-animations uses @angular/animations. It is just a library of animations.

It is quite popular and I have used it is my projects before with no problems.
Only Angular 10 (or my editor settings are causing an issue now).

I realize now it actually works fine if I ng/ionic serve it. The error is just in the editor.

Angular Animations utility library is a collection of reusable and parametrized animations build for Angular 4.4.6+ that can be used in a declarative manner. It implements all animations from animate.css (and more). Works both with AOT and JIT compilations.

1 Like