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

Re-enable "no-undef" eslint rule for type-check #43

Closed
davidhorak opened this issue Sep 2, 2020 · 5 comments · Fixed by #44
Closed

Re-enable "no-undef" eslint rule for type-check #43

davidhorak opened this issue Sep 2, 2020 · 5 comments · Fixed by #44

Comments

@davidhorak
Copy link
Contributor

davidhorak commented Sep 2, 2020

Description

  • Current version of eslint triggers false errors for User Defined Type Guards:
export function isDate (value: unknown): value is Date {
  return value instanceof Date
}
// error  'value' is not defined  no-undef

When fixed, re-enable the no-undef rule:

/* eslint-disable no-undef */

@rthreei
Copy link
Contributor

rthreei commented Sep 2, 2020

I see. Should that be value: any instead?

@davidhorak
Copy link
Contributor Author

I see. Should that be value: any instead?

It is this bit : value is Date , the https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards which triggers the erorr

@davidhorak
Copy link
Contributor Author

I see. Should that be value: any instead?

It is this bit : value is Date , the https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards which triggers the erorr

the eslint sees the "value" variable as "not defined" regardless its type

@rthreei
Copy link
Contributor

rthreei commented Sep 2, 2020

Interesting. Why not disable that lint rule for that line specifically then?

@davidhorak
Copy link
Contributor Author

Interesting. Why not disable that lint rule for that line specifically then?

Great point, 9f36ca2

@davidhorak davidhorak changed the title Re-enable "no-undef" in eslint Re-enable "no-undef" eslint rule for type-check Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants