angular / vscode-ng-language-service

Angular extension for Visual Studio Code
MIT License
781 stars 119 forks source link

Non-exported abstract directive input treated as error #1891

Open csisy opened 1 year ago

csisy commented 1 year ago

🐞 bug report

Is this a regression?

Not sure.

Description

I have an abstract directive with a custom input and another one that extends it:

@Directive()
abstract class MyBaseDirective {
  @Input() myInput = '';
}

@Directive({ selector: 'a[my-directive]' })
export class MyDirective extends MyBaseDirective { /* ... */ }

As you can see, the MyBaseDirective is not even exported from the file, because it is kind of a private DRY solution. The MyDirective is of course declared in the main app module.

When I try to use the myInput of an <a> element...

<a [myInput]="myVar">Link</a>

...I get an error message: Can't bind to 'myInput' since it isn't a known property of 'a'.

The code itself is working fine, and if I export the MyBaseDirective, the error disappears.

Bug Type

What does this bug affect

Expected behavior

The inherited inputs and outputs from a non-exported directive should be detected properly.

🌍 Your Environment

Angular Version:

Angular CLI: 15.2.6
Node: 18.15.0      
Package Manager: npm 9.5.0
OS: win32 x64

Angular: 15.2.8
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.6
@angular-devkit/build-angular   15.2.6
@angular-devkit/core            15.2.6
@angular-devkit/schematics      15.2.6
@angular/cli                    15.2.6
@schematics/angular             15.2.6
rxjs                            7.8.0
typescript                      4.9.5

Extension Version:

v16.0.0

VSCode Version:

Version: 1.77.3 (user setup)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:02.548Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: No

Operating System:

Windows 10 Version 22H2 OS Build 19045.2846

Additional Info

Might be related? https://github.com/angular/vscode-ng-language-service/issues/150

ravindUwU commented 1 year ago

if I export the MyBaseDirective, the error disappears

omg ✨ thanks!!! ✨