Language service doesn't work at all: Cannot read property 'kind' of undefined
See original GitHub issueDescribe the bug
Language service doesn’t work at all. tsserverlibrary
throws an error and extension never start. And consume a lot of CPU.
To Reproduce
Expected behavior
it works
Logs
Please attach two logs:
- Console output (Go to toolbar --> View --> Output, and copy the contents)
[Info - 14:29:20] Using @angular/language-service v9.1.9 from /home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js
[Info - 14:29:20] Log file: /home/yo/.config/Code/logs/20200528T125828/exthost1/Angular.ng-template/nglangsvc.log
[Info - 14:29:27] Enabling language service for /home/yo/Proyectos/my-project/apps/app/tsconfig.json.
/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:30390
finally { if (e_1) throw e_1.error; }
^
TypeError: Cannot read property 'kind' of undefined
at getConditionalFlowTypeOfType (/home/yo/Proyectos/my-project/node_modules/typescript/lib/tsserverlibrary.js:45510:28)
at getTypeFromTypeNode (/home/yo/Proyectos/my-project/node_modules/typescript/lib/tsserverlibrary.js:47396:20)
at getTypeOfNode (/home/yo/Proyectos/my-project/node_modules/typescript/lib/tsserverlibrary.js:67279:40)
at Object.getTypeAtLocation (/home/yo/Proyectos/my-project/node_modules/typescript/lib/tsserverlibrary.js:35196:31)
at getTsTypeFromBuiltinType (/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:28433:28)
at TypeScriptSymbolQuery.getBuiltinType (/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:27600:28)
at getEventDeclaration (/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:26668:30)
at getExpressionScope (/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:26693:21)
at ExpressionDiagnosticsVisitor.getExpressionScope (/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:26458:87)
at ExpressionDiagnosticsVisitor.diagnoseExpression (/home/yo/.vscode/extensions/angular.ng-template-0.901.9/server/node_modules/@angular/language-service/bundles/language-service.umd.js:26775:30)
[Error - 14:29:29] Connection to server got closed. Server will not be restarted.
- Log file (Path is printed to the console output at startup) Nothing anormal. Only initialization log.
Screenshots
Additional context
If I change this code:
to this code (
&& node.parent
):
It works like a charm.
I don’t know if it’s a problem from tsserver
or ng language server
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'kind' of undefined at ...
This is an issue related to the Angular devkit and build optimizer and has to do with version mismatches. I ran into this...
Read more >Working with JavaScript in Visual Studio Code
Using the TypeScript language service, VS Code can provide smart completions (IntelliSense) as well as type checking for JavaScript.
Read more >cannot read property of undefined typescript
TypeError: 'undefined' is not a function; TypeError: Cannot read property '' of undefined; and alike type errors. Uncaught TypeError: Cannot read property ......
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Template type checking - Angular
Troubleshooting template errorslink · When a library's typings are wrong or incomplete (for example, missing null | undefined if the library was not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
TS updates happen automatically on our end 😃
Thanks for the report, closing as resolved.
Yeah, please see https://github.com/angular/vscode-ng-language-service#versioning. Until the extension and the language service are on 3.9 it won’t work. But I think we can update to 3.9 now.