Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

TSLint throwing error in VS Code console (Cannot read property 'kind' of undefined) #3689

Closed
ffxsam opened this issue Feb 2, 2018 · 8 comments

Comments

@ffxsam
Copy link

ffxsam commented Feb 2, 2018

Bug Report

  • TSLint version: 5.9.1
  • TypeScript version: 2.7.1
  • Running TSLint via: (pick one) VSCode

TypeScript code being linted

Not relevant.

with tslint.json configuration:

{
  "defaultSeverity": "error",
  "extends": ["tslint:recommended"],
  "jsRules": {},
  "rules": {
    "indent": [true, "spaces", 2],
    "interface-name": false,
    "arrow-parens": false,
    "newline-before-return": true,
    "no-consecutive-blank-lines": false,
    "no-console": { "severity": "warning" },
    "no-debugger": { "severity": "warning" },
    "no-empty": { "severity": "warning", "options": "allow-empty-catch" },
    "no-irregular-whitespace": true,
    "no-shadowed-variable": false,
    "no-unused-variable": { "severity": "warning" },
    "no-string-literal": false,
    "object-literal-sort-keys": false,
    "object-literal-key-quotes": {
      "severity": "warning",
      "options": "as-needed"
    },
    "ordered-imports": false,
    "prefer-switch": true,
    "semicolon": false,
    "space-within-parens": true,
    "quotemark": [true, "single"],
    "trailing-comma": false,
    "variable-name": true
  },
  "rulesDirectory": []
}

I'm getting the following error in my VS Code console:

[Info  - 12:41:51 AM] Linter is running.
[Info  - 12:41:52 AM] TSLint library loaded from: /Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/tslint/lib/index.js
TypeError: Cannot read property 'kind' of undefined
    at declareSymbolAndAddToSymbolTable (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:21243:30)
    at bindPropertyOrMethodOrAccessor (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:22217:19)
    at bindWorker (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:21770:28)
    at bind (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:21619:13)
    at bindSourceFile (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:20028:17)
    at Object.bindSourceFile (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:19971:9)
    at initializeTypeChecker (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:47292:20)
    at Object.createTypeChecker (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:24912:9)
    at getDiagnosticsProducingTypeChecker (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:74325:93)
    at Object.getGlobalDiagnostics (/Volumes/SuperData/Sites/reelcrafter/reelcrafter-ui/node_modules/typescript/lib/typescript.js:74703:53)

Things were fine until I did a yarn upgrade just now. Honestly it's a bit tough to tell if it's coming from TSLint or TypeScript itself, but I figured I'd start here.

@Xample
Copy link

Xample commented Feb 5, 2018

I've the same problem and my diagnostic is that it's from typescript (not tslint) as

  • the error is coming from typescript.js
  • disabling the listing on cordova using --enableLint falsem does not change anything.

@ffxsam
Copy link
Author

ffxsam commented Feb 5, 2018

I wound up removing TS from my Vue project. I feel this particular combo is just not ready for prime time.

@Xample
Copy link

Xample commented Feb 5, 2018

For your information, I had this problem while trying to build an ionic project in prod. I installed yarn and used it instead of npm, this fixed my issue.

npm i -save yarn
yarn
ionic cordova build android --prod

@hiroki-gota
Copy link

Xample Solve the same problem. Thank you very much.
I wonder what makes this different though...

bitjson added a commit to bitjson/copay that referenced this issue Feb 20, 2018
Fixes issue with `npx ionic build --prod` similar to: palantir/tslint#3689
@johnwiseheart
Copy link
Contributor

Hi there,

I think this is a dupe of #3711

Feel free to re-open if you disagree.

Thanks,
TSLint Team

@ghost
Copy link

ghost commented Apr 5, 2018

Same Issue. Installing yarn and updating typescript to 2.8.1 do not solve.
The issue only pop with the "ionic cordova build android --prod"
but not without the "--prod" flag "ionic cordova build android".

TypeError: Cannot read property 'kind' of undefined at declareSymbolAndAddToSymbolTable (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:22164:31) at bindPropertyOrMethodOrAccessor (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:23169:19) at bindWorker (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:22690:28) at bind (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:22538:13) at bindSourceFile (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:20944:17) at Object.bindSourceFile (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:20887:9) at initializeTypeChecker (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:49034:20) at Object.createTypeChecker (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:25936:9) at getDiagnosticsProducingTypeChecker (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:76224:93) at emitWorker (/Users/me/Desktop/proj/client/node_modules/typescript/lib/typescript.js:76270:32)

@BinaryBlock
Copy link

Same Issue

Running typescript 2.8.1.
The issue only pops up with the "ionic cordova build ios --prod"
but works without the "--prod" flag "ionic cordova build ios".

ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0 browser 5.0.1 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-deploy : 1.9.2
    ios-sim    : 6.0.0
    Node       : v8.9.4
    npm        : 5.6.0
    OS         : macOS High Sierra
    Xcode      : Xcode 9.3 Build version 9E145

Environment Variables:

    ANDROID_HOME : ~/Library/Android/sdk

Misc:

    backend : pro

Here is error output:

☁  XXXXXXXX [master] ⚡ ionic cordova build ios --release --prod
Running app-scripts build: --prod --platform ios --target cordova
[10:50:07]  build prod started ...
[10:50:07]  clean started ...
[10:50:07]  clean finished in 4 ms
[10:50:07]  copy started ...
[10:50:07]  deeplinks started ...
[10:50:07]  deeplinks finished in 62 ms
[10:50:07]  ngc started ...
TypeError: Cannot read property 'kind' of undefined
    at declareSymbolAndAddToSymbolTable (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:22164:31)
    at bindPropertyOrMethodOrAccessor (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:23169:19)
    at bindWorker (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:22690:28)
    at bind (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:22538:13)
    at bindSourceFile (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:20944:17)
    at Object.bindSourceFile (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:20887:9)
    at initializeTypeChecker (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:49034:20)
    at Object.createTypeChecker (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:25936:9)
    at Object.getTypeChecker (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:76230:79)
    at moduleNameResolvesToAmbientModuleInNonModifiedFile (/Users/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/node_modules/typescript/lib/typescript.js:75986:88)
[10:50:25]  copy finished in 17.89 s

We don't need to move to Production yet... so I will let this simmer and hope someone patches.

Thanks.

@jwelmac
Copy link

jwelmac commented May 8, 2018

Hey @BinaryBlock,
Check if you have @angular/cli installed directly in your package.json.
There seems to be a conflict with the typescript version installed via @ionic/app-scripts and @angular/cli that results in an error in the ngc command during a production build.

If it is installed as a direct dependency:

  • remove it: npm un @angular/cli
  • add yarn: npm i yarn
  • reinstall using yarn: yarn add @angular/cli -D.
    You may also need to specify your version if not using @angular/[email protected].

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants