After upgraded to Angular CLI 1.5.0
ng build command resulted in the follwing error:
ERROR in app/app-error.handler.ts error TS2554: Expected 0 arguments, but got 1.
Angular CLI: 1.5.0
Node: 8.9.0
OS: win32 x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
@angular/cdk: 5.0.0-rc0
@angular/cli: 1.5.0
@angular/material: 5.0.0-rc0
@angular-devkit/ build-optimizer: 0.0.33
@angular-devkit/ core: 0.0.20
@angular-devkit/ schematics: 0.0.35
@ngtools/ json-schema: 1.1.0
@ngtools/ webpack: 1.8.0
@schematics/ angular: 0.1.3
typescript: 2.6.1
webpack-hot-middleware: 2.19.1
webpack-merge: 4.1.0
webpack: 3.6.0
When checking the app-error.handler.ts , the line:
import { Injectable, ErrorHandler } from '@angular/core';
has "Injectable" and "Error handler" underlined with the errors:
[ts] Module '"c:/...../node_modules/@angular/core/core"' has no exported member 'Injectable'.
[ts] Module '"c:/...../node_modules/@angular/core/core"' has no exported member 'ErrorHandler'.
Update:
After a machine reboot, the words "Injectable" and "Error handler" were not underlined but this time it was the argument "super(true)" in the constructor below:
constructor() {
super(true);
}:
Here the error is:
constructor ErrorHandler(): ErrorHandler
This doesn’t appear to be related to the CLI. The constructor being called doesn’t take an argument. Remove the ‘true’ from the super call.
Removing the ‘true’ from the super call releases the error, but I wonder why it is supplied originally with 'true' if I have to remove it.
That file doesn't exist in a newly generated project.
The constructor parameter was deprecated in Angular 4 and removed in Angular 5.
As @clydin pointed out, the constructor parameter was removed in Angular 5. I'm closing this as solved/answered.
Hi ,
how to solve this problem any body help me.
using Angular2
Error TS2554: Expected 3 arguments, but got 0.
error TS2554: Expected 2 arguments, but got 1.
Here sign(myForm){
if(myForm.valid){
this.af.auth.createUserWithEmailAndPassword({ //here is the problem
email:this.email,
password:this.password
}).then(
(success)=> {
console.log(success);
this.router.navigate(['/login'])
}).catch(
(err)=> {
console.log(err);
this.error=err;
})
}
}
@durjoy28 : It so appears that your createUserWithEmailAndPassword function is expecting two parameters whereas you're sending an object, which is 01 parameter. Try sending the email and password as individual parameters, maybe?
error TS2554: Expected 2 arguments, but got 1.
onFormSubmit(form:NgForm) {
this.api.updateBook(this.id, form)
.subscribe(res => {
let id = res['_id'];
this.router.navigate(['/book-details', id]);
}, (err) => {
console.log(err);
}
);
}
ERROR in src\app\modules\configuration\external-system\containers\external-system-home.component.ts.ExternalSystemHomeComponent.html(2,33): : Expected 0 arguments, but got 1.
ERROR in src\app\modules\configuration\external-system\containers\external-system-home.component.ts.ExternalSystemHomeComponent.html(2,33): : Expected 0 arguments, but got 1.
When this happened to me, I found that it was a function I was calling from the html with a parameter, but in the ts file no parameters were expected.
Example:
HTML FILE
<app-filters (OnClear)="this.clearFilter($event)">
TS FILE
clearFilter() {....}
You can see that in your project says that is on the line 2, check if is the same error
My problem is solved.
On Wed, Feb 27, 2019 at 2:25 AM Francisco Andres Flores Fanelli <
[email protected]> wrote:
ERROR in
src\app\modules\configuration\external-system\containers\external-system-home.component.ts.ExternalSystemHomeComponent.html(2,33):
: Expected 0 arguments, but got 1.When this happened to me, I found that it was a function I was calling
from the html with a parameter, but in the ts file no parameters were
expected.Example:
HTML FILE
TS FILE
clearFilter() {....}You can see angular says that is on the line 2
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/8514#issuecomment-467599173,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATuxWXMvsudgbWiecn68RCJ4271z154tks5vRZgtgaJpZM4Qgr99
.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
When this happened to me, I found that it was a function I was calling from the html with a parameter, but in the ts file no parameters were expected.
Example:
HTML FILE
<app-filters (OnClear)="this.clearFilter($event)">TS FILE
clearFilter() {....}You can see that in your project says that is on the line 2, check if is the same error