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

Private instance method throws error, Cannot read property 'flags' of undefined #1601

Closed
jperl opened this issue Oct 5, 2016 · 7 comments
Closed

Comments

@jperl
Copy link

jperl commented Oct 5, 2016

Bug Report

  • TSLint version: 3.15.1 and 4.0.0-dev.0
  • TypeScript version: 2.0.3
  • Running TSLint via: CLI

TypeScript code being linted

 private getQuality = ({ dataKey, rowData: { quality } }) => quality[dataKey];

Actual behavior

/Users/jperl/dev/my-project/node_modules/typescript/lib/typescript.js:49932
            var flags = symbol.flags;
                              ^
TypeError: Cannot read property 'flags' of undefined
    at displayPartKind (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:49932:31)
    at symbolPart (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:49930:34)
    at Object.writeSymbol (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:49917:31)
    at buildBindingElementDisplay (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18782:28)
    at /Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18763:110
    at buildDisplayForCommaSeparatedList (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18809:21)
    at buildBindingPatternDisplay (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18763:21)
    at buildParameterDisplay (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18747:21)
    at buildDisplayForParametersAndDelimiters (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18837:21)
    at buildSignatureDisplay (/Users/jperl/my-project/node_modules/typescript/lib/typescript.js:18883:17)

Expected behavior

No error.

@adidahiya
Copy link
Contributor

what does your tslint.json look like? can you track down which rule is throwing this exception? that stack trace doesn't have any reference to tslint in it, which is a bit strange...

@jperl
Copy link
Author

jperl commented Oct 5, 2016

tslint.json

{
  "extends": ["tslint:latest", "tslint-react"],
  "rules": {
    "no-console": [false],
    "quotemark": [true, "single"]
  }
}

@jperl
Copy link
Author

jperl commented Oct 5, 2016

When I change the code to

  private getQuality = (options) => {
    const { dataKey, rowData: { quality } } = options;
    return quality[dataKey];
  };

it runs fine

@grovesNL
Copy link

grovesNL commented Oct 19, 2016

I just ran into the same issue, i.e.:

function test({ x: { y } }) {
    console.log(y);
}
test({ x: { y: "test" } });

will fail with the var flags = symbol.flags exception.

Here's the complete call stack while linting the above example:
tslint

Perhaps it's a TypeScript issue?

@adidahiya
Copy link
Contributor

looks like a duplicate of #1641, see my comment: #1641 (comment)

I recommend disabling the no-unused-variable rule and using the compiler checks instead

@grovesNL
Copy link

@adidahiya Thanks, I missed that issue. Will do!

@ghost
Copy link

ghost commented Mar 15, 2017

Should be fixed by #2235.

@nchen63 nchen63 closed this as completed Mar 16, 2017
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

4 participants