Ionic build when using a custom pipe: Supplied parameters do not match any signature of call target


#1

Since ionic2-rc0 I get this error when I am running ionic build when using a custom pipe:

 ngc error: Error: Error at myApp/.tmp/pages/test/test.ngfactory.ts:1450:81: Supplied parameters do not match any signature of call target.
    at check (myApp\node_modules\@angular\tsc-wrapped\src\tsc.js:31:15)
    at Tsc.typeCheck (myApp\node_modules\@angular\tsc-wrapped\src\tsc.js:86:9)
    at myApp\node_modules\@angular\tsc-wrapped\src\main.js:33:23
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Function.Module.runMain (module.js:449:11)
    at startup (node.js:146:18)
    at node.js:404:3

I am using a simple Pipe:

import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'exponentialStrength'})
export class ExponentialStrengthPipe implements PipeTransform {
  transform(value: number, exponent: string): number {
    let exp = parseFloat(exponent);
    return Math.pow(value, isNaN(exp) ? 1 : exp);
  }
}

I am calling it by:

<span>My test: {{test.aNumber | exponentialStrength}}</span>

does someone has an idea, what is wrong?
Removing the html line makes ionic build run without an error. The pipe itself is working fine since it is working when i add the html line while ionic serve is running.


#2

Open that file (myApp/.tmp/pages/test/test.ngfactory.ts) in Atom with TypeScript plugin. He will show the line with error, then you can debug.

I had the same error “Supplied parameters do not match any signature of call target.”. My problem was the function called in template had argument and in .TS not.


#3

You need to make exponent optional:

exponent?: string)

#4

Thanks @ludufre for the hint. I already took a look to the transpiled JS code but it was not obviously what is wrong.

@SigmundFroyd that’s it, thx.


#5

I had a similar issue with custom pipes, @SigmundFroyd’s answer, solved it!!! Thanks a lot. :raised_hands::raised_hands: