"TypeError: Cannot read property 'flags' of undefined" with no-unused-variable rule.
TypeScript 2.4.1
https://unpkg.com/[email protected]/
TSlint 5.5.0
https://unpkg.com/[email protected]/
Running TSlint via CLI (package.json script with tslint --type-check --project "./tsconfig.json" -c "./tslint.json" "./src/**/*.ts")
TypeError: Cannot read property 'flags' of undefined
at Object.getCheckFlags (/PROJECT/node_modules/typescript/lib/typescript.js:10137:22)
at getTypeOfSymbol (/PROJECT/node_modules/typescript/lib/typescript.js:30957:20)
at getTypeOfNode (/PROJECT/node_modules/typescript/lib/typescript.js:47329:24)
at Object.getTypeAtLocation (/PROJECT/node_modules/typescript/lib/typescript.js:26823:31)
at getImplicitType (/PROJECT/node_modules/tslint/lib/rules/noUnusedVariableRule.js:269:24)
at cb (/PROJECT/node_modules/tslint/lib/rules/noUnusedVariableRule.js:259:20)
at visitEachNode (/PROJECT/node_modules/typescript/lib/typescript.js:15956:30)
at Object.forEachChild (/PROJECT/node_modules/typescript/lib/typescript.js:16143:24)
at cb (/PROJECT/node_modules/tslint/lib/rules/noUnusedVariableRule.js:264:19)
at visitNode (/PROJECT/node_modules/typescript/lib/typescript.js:15944:20)
tslint.json configuration:
{
"extends": "tslint:recommended",
"rules": {
"no-floating-promises": true,
"promise-function-async": true,
"await-promise": true,
"no-unused-variable": true,
"no-unused-expression": true,
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore",
"allow-trailing-underscore",
"allow-pascal-case"
],
"ordered-imports": [
true,
{
"import-sources-order": "case-insensitive",
"named-imports-order": "lowercase-last"
}
],
"no-console": [
false
],
"interface-name": [
false
]
},
"jsRules": {
"ordered-imports": [
true,
{
"import-sources-order": "case-insensitive",
"named-imports-order": "case-insensitive"
}
]
},
"rulesDirectory": []
}
I have been having the same problem for some months now too.
I personally don't want to use the typescript options that achieve the same result as no-unused-variable (mainly because when you are in dev mode, you don't really care if there is unused imports or stuffs like that…).
@danielweck I don't think it is related, #2649 seems to appear only on windows and I have the same exact problem as you on linux :)
See also #2876
I have the exact same stacktrace in our (private) project,
From what I have read, the only difference I can spot between this error and #2876 is that it also occurs when there is no unused variable.
Wich means the stacktrace is part of the output on every build for us.
we have same issue as well
tslint 5.5.0
typescript 2.2.2
env: OSX
I have the same issue as well.
tslint: 5.5.0
TypeScript: 2.4.1
OS: Ubuntu 16.04.2
https://travis-ci.org/westy92/html-pdf-chrome/jobs/255121048#L1299
same issue here
tslint: 5.5.0
TypeScript: 2.4.2
OS: OSX
I have submitted PR for this: https://github.com/Microsoft/TypeScript/pull/17367
Does anyone have a simple codebase to reproduce the issue as a regression test?
@DanielRosenwasser #2876 contains a minimal reproduction for this issue
Most helpful comment
I have submitted PR for this: https://github.com/Microsoft/TypeScript/pull/17367