AOT error after upgrading to Angular v4 final

After updating the final v4-rc final form to v4, I get the following error when I call "ng build -prod" and don't know where to start looking for the problem.

<P -> ERROR in c: //src/$$_gendir/app/app.module.ngfactory.ts (1,1): The supplied parameters do not match any signature of the target call. & L; <<

The message is repeated once more, but no additional information is provided.

Any ideas?

Regards, Mark

+3


source to share


1 answer


Angular-cli command:

We fixed an issue with AOT and templates where bugs were not always reported. Now they should be. This can lead to the appearance of previously hidden bugs that existed in your codebase.

So this is the intended behavior.

What the error says is that you are calling a method, but the arguments you provided do not match the declaration of that method.

Example

Method declaration:

private myMethod(arg: any) {}

      

How do you call it:

this.myMethod();

      




In my case, I used a router transition callback:

@Component({
  ...,
  host: { '[@routerTransition]': '', '(@routerTransition.done)': 'init($event)' },
  ...
})

      

And the init method declaration was as follows:

public init() { }

      

I had to fix this by adding the missing argument:

public init(event: any) { }

      


NB: Perhaps it could be the other way around: calling a function with more arguments than required.

+2


source







All Articles