angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

The method "[[METHODNAME]]" that you're trying to access does not exist in the class declaration

Open shahraship opened this issue 9 years ago • 4 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.3.1 node: 8.2.1 os: darwin x64 @angular/animations: 4.3.6 @angular/cdk: 2.0.0-beta.10 @angular/common: 4.3.6 @angular/compiler: 4.3.6 @angular/core: 4.3.6 @angular/flex-layout: 2.0.0-rc.1 @angular/forms: 4.3.6 @angular/http: 4.3.6 @angular/material: 2.0.0-beta.10 @angular/platform-browser: 4.3.6 @angular/platform-browser-dynamic: 4.3.6 @angular/router: 4.3.6 @angular/service-worker: 1.0.0-beta.16 @angular/cli: 1.3.1 @angular/compiler-cli: 4.3.6 @angular/language-service: 4.3.6

Repro steps.

  1. Create a parent abstract class
  2. Add a public function in that class
  3. Create a component that extends the parent class
  4. In the HTML of the component, invoke the function defined in the parent class (works perfectly fine)
  5. Call the command: "ng lint" <-- This will gives an error stating that the method doesn't exists in the class declaration

The log given by the failure.

ERROR: [PATH]/mytest.component.html[1, 1]: The method "[[METHODNAME]]" that you're trying to access does not exist in the class declaration.

Desired functionality.

I would like the command "ng lint" to realize that the component is extending a parent class and look for the function implementation in the parent class, instead of throwing an error.

Mention any other details that might be useful.

shahraship avatar Sep 03 '17 21:09 shahraship

I've the same issue

CaselIT avatar Sep 04 '17 10:09 CaselIT

Also, the same is true for inherited class properties: The property "[[PROPERTY_NAME]]" that you're trying to access does not exist in the class declaration.

It actually works, but the ng lint command does not seem to like it.

I'm working with slightly older angular package versions:

"@angular/cli": "^1.3.0",
"@angular/common": "^4.3.4",
"@angular/compiler": "^4.3.4",
"@angular/compiler-cli": "^4.3.4",
"@angular/core": "^4.3.4",
"@angular/forms": "^4.3.4",
"@angular/http": "^4.3.4",
"@angular/platform-browser": "^4.3.4",
"@angular/platform-browser-dynamic": "^4.3.4",
"@angular/router": "^4.3.4"

mspl13 avatar Sep 04 '17 17:09 mspl13

I'm sorry but this error is not fixable in Angular CLI. ng lint uses TSLint and Codelyzer, and I suspect this is a bug in Codelyzer. Can you please open an issue in https://github.com/mgechev/codelyzer instead?

filipesilva avatar Sep 05 '17 09:09 filipesilva

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.