我的 TS 回调有一个简单的问题。
我有这样的功能
...
//inside a class
//function is supposed to optionally accept any callback function
refreshConnection(callback?:Function) {
//do something
//then call the passed callback with no params
callback();
}
...
//in another component, i call this function like so
this.myclass.refreshConnection( () => {
window.location.reload();
});
//but i get an error saying that the function parameter does not match a signature.
// i also tried callback?: (...args: any[]) => any but nothing.
ERROR in ./src/app/fb_connect.component.ts
Module build failed: Error: …Run Code Online (Sandbox Code Playgroud)