question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Language service doesn't work at all: Cannot read property 'kind' of undefined

See original GitHub issue

Describe 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:

  1. 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.
  1. Log file (Path is printed to the console output at startup) Nothing anormal. Only initialization log.

Screenshots

Additional context

If I change this code: image to this code (&& node.parent): image It works like a charm.

I don’t know if it’s a problem from tsserver or ng language server

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ayazhafizcommented, May 28, 2020

TS updates happen automatically on our end 😃

Thanks for the report, closing as resolved.

1reaction
ayazhafizcommented, May 28, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found