Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no-undef] No-undef error on user-defined Typescript type guards #2462

Closed
victorgarciaesgi opened this issue Sep 1, 2020 · 3 comments
Closed

Comments

@victorgarciaesgi
Copy link

@victorgarciaesgi victorgarciaesgi commented Sep 1, 2020

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    '@typescript-eslint/no-useless-constructor': 'error',
    '@typescript-eslint/no-unused-vars': 'off',
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
    '@typescript-eslint/no-use-before-define': 'off',
    '@typescript-eslint/interface-name-prefix': 'off',
    '@typescript-eslint/no-var-requires': 'off',
    '@typescript-eslint/no-namespace': 'off',
    '@typescript-eslint/camelcase': 'off',
    '@typescript-eslint/no-empty-function': 'off',
    '@typescript-eslint/ban-ts-ignore': 'off',
    '@typescript-eslint/explicit-module-boundary-types': 'off',
    '@typescript-eslint/ban-ts-comment': 'off',
    '@typescript-eslint/no-non-null-assertion': 'off',
  }
}
@Component
export default class Column extends Vue {
  isColumnString(column: TableColumn): column is string {
                                   //   ^^^^^ 'column' is not defined (eslint: no-undef)
    return typeof this.column === 'string';
  }
}

Expected Result

Actual Result

Versions

package version
@typescript-eslint/eslint-plugin 4.0.1
@typescript-eslint/parser 4.0.1
TypeScript 4.0.2
ESLint 7.8.0
node 12.18.0
@jacekkarczmarczyk
Copy link

@jacekkarczmarczyk jacekkarczmarczyk commented Sep 1, 2020

Is this bug related/duplicate?

@vvscode
Copy link

@vvscode vvscode commented Sep 2, 2020

@jacekkarczmarczyk in fact it's another problem, but it might be caused with same reason

@bradzacher bradzacher self-assigned this Sep 5, 2020
@bradzacher bradzacher added the has pr label Sep 5, 2020
bradzacher added a commit that referenced this issue Sep 5, 2020
Fixes #2462
bradzacher added a commit that referenced this issue Sep 5, 2020
Fixes #2462
phaux added a commit to phaux/typescript-eslint that referenced this issue Sep 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.