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

fix(eslint-plugin): added safe getTypeOfPropertyOfType wrapper #2567


Copy link

@JoshuaKGoldberg JoshuaKGoldberg commented Sep 15, 2020

Fixes #2143. A quick find-all on getTypeOfPropertyOfType showed that the bug might also be able to pop up in no-unnecessary-condition as well.

Copy link

@typescript-eslint typescript-eslint bot commented Sep 15, 2020

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!

🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

Copy link

@bradzacher bradzacher commented Sep 15, 2020

We should add a lint rule for this to warn against using the method directly.

Could expand this internal lint rule to cover it:

@bradzacher bradzacher added the bug label Sep 15, 2020
Copy link
Contributor Author

@JoshuaKGoldberg JoshuaKGoldberg commented Sep 15, 2020

TBD whether this original approach works, but it would also be nice to not use an internal TypeScript compiler API... I'd be interested in looking at that too.

Copy link

@codecov codecov bot commented Sep 15, 2020

Codecov Report

Merging #2567 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2567      +/-   ##
- Coverage   92.82%   92.82%   -0.01%     
  Files         290      291       +1     
  Lines        9505     9514       +9     
  Branches     2664     2666       +2     
+ Hits         8823     8831       +8     
  Misses        323      323              
- Partials      359      360       +1     
Flag Coverage Δ
#unittest 92.82% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...slint-plugin/src/rules/no-unnecessary-condition.ts 97.14% <ø> (ø)
packages/eslint-plugin/src/util/isTypeReadonly.ts 97.01% <ø> (ø)
packages/eslint-plugin/src/util/propertyTypes.ts 88.88% <ø> (ø)
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review Sep 15, 2020
Copy link

@bradzacher bradzacher left a comment

LGTM - thanks for fixing this!

@bradzacher bradzacher merged commit 7cba2de into typescript-eslint:master Sep 27, 2020
10 checks passed
10 checks passed
Unit tests Unit tests
Code style and lint
Run integration tests on primary Node.js version
Run unit tests on other Node.js versions (10.x)
Run unit tests on other Node.js versions (14.x)
Publish the latest code as a canary version
Semantic Pull Request ready to be squashed
codecov/patch Codecov Report
codecov/project Codecov Report
phaux added a commit to phaux/typescript-eslint that referenced this pull request Sep 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants