fix(compiler): Update type check block to fix control flow source mappings#53980
fix(compiler): Update type check block to fix control flow source mappings#53980atscott wants to merge 3 commits intoangular:mainfrom
Conversation
…pings The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988
| initializer = ts.factory.createAsExpression( | ||
| initializer, ts.factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword)); | ||
| } | ||
| const initializer: ts.Expression = ts.factory.createAsExpression( |
There was a problem hiding this comment.
If we're going to cast for all cases, should we just not pass the type in createVariableDeclaration? E.g. const _t1 = null! as Foo instead of const _t1: Foo = null! as Foo.
There was a problem hiding this comment.
Yea, so I also had this thought and it mostly works. The problem is with the "find references" operation. If I find references for Foo, instead of getting the variable t1, I get the type assertion. This makes it difficult to get the correct source map for the variable. It's technically possible, but would require some adjustments in logic for references that I'm not sure is worth it. I'll add a comment about this because Alex had the same question.
There was a problem hiding this comment.
I don't feel strongly about it, but I'm concerned if it won't have any impact on type checking performance.
There was a problem hiding this comment.
Okay, I added a fixup commit to adjust the references code to account for this. Let me know how you feel about it.
bec11c7 to
75781cc
Compare
1bd5da6 to
3d2da2e
Compare
…pings (#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close #53980
|
This PR was merged into the repository by commit eddf5da. |
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
|
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. |
The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information.
fixes angular/vscode-ng-language-service#1988