angular: Language service error Warning:(1, 1) Angular Language Service internal globalError: Cannot read property 'charCodeAt' of undefined

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Warning:(1, 1) Angular Language Service internal globalError: Cannot read property 'charCodeAt' of undefined

when configured template with templateRef:

  <Slideritem [templateRef]="g">
                <template #g>
                </template>
            </Slideritem>

Expected behavior no error

@angular/cli: 1.0.0-beta.30
node: 6.9.5
os: win32 x64
@angular/cli: 1.0.0-beta.30
@angular/common: 2.4.6
@angular/compiler: 2.4.6
@angular/core: 2.4.6
@angular/forms: 2.4.6
@angular/http: 2.4.6
@angular/language-service: 2.4.6
@angular/platform-browser: 2.4.6
@angular/platform-browser-dynamic: 2.4.6
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.6
@ngtools/webpack: 1.2.8

Angular 2 Kitchen sink: http://ng2.javascriptninja.io and source@ https://github.com/born2net/Angular-kitchen-sink Regards,

Sean

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 24 (2 by maintainers)

Most upvoted comments

In my project I’ve got a similar warning: Warning:(1, 1) Angular Language Service internal globalError: Cannot read property 'has' of undefined

Same here with 2.4.9 (both angular core and language service)

Seems an upgrade to LS 4.0.0 did not fix the issue

Node 7.5.0 Typescript 2.2.1 Angular 4.0.0 Angular LS 4.0.0

screenshot_3

Process: Error processing message: Cannot read property 'hasOwnProperty' of undefined TypeError: Cannot read property 'hasOwnProperty' of undefined
    at toSymbols (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:48013:33)
    at new SymbolTableWrapper (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:48248:28)
    at SymbolWrapper.members (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:48132:60)
    at AstType.resolvePropertyRead (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:45467:35)
    at AstType.visitPropertyRead (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:45408:21)
    at PropertyRead.visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:18690:24)
    at AstType.getType (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:45167:61)
    at C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:45457:96
    at Array.map (native)
    at AstType.resolveMethodCall (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:45457:62)
Process: Error processing message: Cannot read property '__constructor' of undefined TypeError: Cannot read property '__constructor' of undefined
    at TypeScriptSymbolQuery.getTemplateRefContextType (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:47960:39)
    at TypeScriptSymbolQuery.getTemplateContext (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:47935:36)
    at ExpressionDiagnosticsVisitor.visitVariable (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:47029:52)
    at VariableAst.visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16446:24)
    at visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16681:37)
    at C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16683:42
    at Array.forEach (native)
    at templateVisitAll (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16682:10)
    at visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:44866:30)
    at C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:44827:13
Process: Error processing message: Cannot read property '__constructor' of undefined TypeError: Cannot read property '__constructor' of undefined
    at TypeScriptSymbolQuery.getTemplateRefContextType (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:47960:39)
    at TypeScriptSymbolQuery.getTemplateContext (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:47935:36)
    at ExpressionDiagnosticsVisitor.visitVariable (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:47029:52)
    at VariableAst.visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16446:24)
    at visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16681:37)
    at C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16683:42
    at Array.forEach (native)
    at templateVisitAll (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:16682:10)
    at visit (C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:44866:30)
    at C:\Users\Jeroen\IdeaProjects\EVE Track\client\node_modules\@angular\language-service\bundles\language-service.umd.js:44827:13

I changed it to 2.1.5 but still get globalErrors

Warning:(1, 1) Angular Language Service internal globalError: Cannot read property ‘hasOwnProperty’ of undefined Warning:(1, 1) Angular Language Service internal globalError: Cannot read property ‘__constructor’ of undefined

Updating to angular & language service from 4.0.1 to 4.0.2 solved it for me:

@angular/language-service: 4.0.2 typescript 2.2.2 node: 6.10.0 os: mac os IntelliJ 2017.1