Repository navigation
feat(compiler-cli): resolve type of exported *ngIf variable. - #33016
andrius-pra wants to merge 1 commit into
Conversation
ayazhafiz
left a comment
There was a problem hiding this comment.
Can you add tests that check that this change correctly determines the type of exported variable?
ayazhafiz
left a comment
There was a problem hiding this comment.
Sorry that I wasn't more clear earlier @andrius-pra; what I mean is, can we also add tests that bindingType returned in the compiler code is what we expect it to be?
|
@ayazhafiz, I'm not sure where I should add this test. Tests of compiler-cli doesn't check the type of scoped variables. It only verify that compiler will produce specific diagnostic message. Do I need to introduce a new type of tests in compiler-cli package that will check result of getExpressionScope or getVarDeclarations? |
|
I'm not sure. Perhaps it is best to defer to the compiler team to ask what they would like to do. ping @angular/fw-compiler |
ayazhafiz
left a comment
There was a problem hiding this comment.
LGTM for Language Service
petebacondarwin
left a comment
There was a problem hiding this comment.
It would be really helpful for reference to include more information in the commit message, explaining what this commit is doing an why it is needed.
Perhaps similar to what has been written in the description PR?
Currently, method `getVarDeclarations()` does not try to resolve the type of exported variable from *ngIf directive. It always returns `any` type. By resolving the real type of exported variable, it is now possible to use this type information in language service and provide completions, go to definition and quick info functionality in expressions that use exported variable. Also language service will provide more accurate diagnostic errors during development.
|
I have updated commit message. |
|
thank you @andrius-pra! |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What is the current behavior?
Angular compiler does not resolve the type of exported variable from *ngIf directive. It always returns
anytype. So language service can't provide completions for type members.Issue Number: angular/vscode-ng-language-service#255
What is the new behavior?
Compiler will try resolve type of exported variable and will use this type for type-checking. Angular language service will use this type for completions, go to definition and quick info functionality. Also language service will provide more accurate diagnostic errors during development.
Does this PR introduce a breaking change?
Other information