TypeScript: Cannot read property 'flags' of undefined

Been dealing with this for months, please fix.

./src/app/auth/auth.manager.ts
Module build failed: TypeError: Cannot read property 'flags' of undefined
    at resolveAlias (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:28064:36)
    at checkAliasSymbol (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46447:26)
    at checkImportBinding (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46477:13)
    at Object.forEach (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:1506:30)
    at checkImportDeclaration (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46498:32)
    at checkSourceElement (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46789:28)
    at Object.forEach (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:1506:30)
    at checkSourceFileWorker (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46862:20)
    at checkSourceFile (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46842:13)
    at getDiagnosticsWorker (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46906:17)
    at getDiagnostics (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:46892:24)
    at Object.getEmitResolver (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:27162:13)
    at C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:70021:69
    at runWithCancellationToken (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:69779:24)
    at getDeclarationDiagnosticsForFileNoCache (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:70020:20)
    at getAndCacheDiagnostics (C:\Users\brian.cullinan\Documents\portal\node_modules\typescript\lib\typescript.js:70033:26)
 @ ./src/app/core/core.module.ts 19:0-51
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:9090 ./src/main.ts

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

I got it to break in the typescript compiler on an Injectable token, but I am not sure what file or anything unusual that is causing it:

image

I’ll probably hunt around a bit and then try some different versions. Thank you for the good starting point!

Cool, just got it to fail in the debugger. Looks like if you are editing a file in watch mode, and you create something invalid like <new line> alert with no semi-colon. Save. Edit, and remove the line alert.
Watch never recovers from errors and just displays this flags error.

image