Typescript Error Expected 0 arguments, but got 2 in Ionic Framework Typescript Error Expected 0 arguments, but got 2 in Ionic Framework angular angular

Typescript Error Expected 0 arguments, but got 2 in Ionic Framework


The problem is with the loginAPI function definition.Adding the return type to Observable<any> made the compiler happy and solved the issue.

// auth-provider.tspublic loginAPI(credentials: {email:string,password:string}):Observable<any> {  return this.http.post(this.apiUrl,data);}

Still I don't really understand very well why, but at least now it compiles without any error.


In order to handler this you can create a class as follows,

public class credentials export {   email : string;   password: string;}

and then,

public loginAPI(inCredentials : credentials ) {  return this.http.post(this.apiUrl,data);}