Encountering an issue with TS callbacks and function signatures.
Here is my scenario:
...
//inside a class
//function should accept a callback function as parameter
refreshConnection(callback?: Function) {
//do something
//then call the provided callback without any parameters
callback();
}
...
//calling this function in another component like this
this.myclass.refreshConnection( () => {
window.location.reload();
});
//however, receiving an error indicating that the function parameter does not match the signature.
//also attempted using callback?: (...args: any[]) => any but without success.
ERROR in ./src/app/fb_connect.component.ts
Module build failed: Error: /var/www/mysite/frontend/angular2/src/app/fb_connect.component.ts (70,41): Supplied parameters do not match any signature of call target.)
at _checkDiagnostics (/var/www/mysite/frontend/angular2/node_modules/@ngtools/webpack/src/loader.js:115:15)
at /var/www/mysite/frontend/angular2/node_modules/@ngtools/webpack/src/loader.js:140:17
@ ./src/app/app.module.ts 15:0-51
@ ./src/app/index.ts
@ ./src/main.ts
Additional information: The problematic function call for refreshConnection can be found at line (70,41). Temporarily commenting it out resolves the issue.