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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint-plugin): [no-unsafe-argument] handle tuple types on rest arguments

Merged
merged 1 commit into from Apr 6, 2021

Conversation

bradzacher
Copy link
Member

@bradzacher bradzacher commented Apr 5, 2021

@G-Rath noticed that we were false-reporting on jest expect functions.
Turns out this was because I hadn't handled tuple rest types.

It turns out that generic array rest types are reported by TS as if they were tuples.
So for function foo<T extends any[]>(...param: T): void - param will always report as a tuple.
Eg foo(1, 2, 'a', 1 as any) will report the type of param to be [number, number, string, any]. Which means we can't actually do a check here 馃槩

@bradzacher bradzacher added the bug label Apr 5, 2021
@typescript-eslint
Copy link
Contributor

typescript-eslint bot commented Apr 5, 2021

Thanks for the PR, @bradzacher!

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 https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@codecov
Copy link

codecov bot commented Apr 5, 2021

Codecov Report

Merging #3269 (b8494a7) into master (9238e91) will increase coverage by 0.01%.
The diff coverage is 81.25%.

@@            Coverage Diff             @@
##           master    #3269      +/-   ##
==========================================
+ Coverage   92.80%   92.82%   +0.01%     
==========================================
  Files         318      318              
  Lines       10984    11003      +19     
  Branches     3105     3110       +5     
==========================================
+ Hits        10194    10213      +19     
  Misses        350      350              
  Partials      440      440              
Flag Coverage 螖
unittest 92.82% <81.25%> (+0.01%) 猬嗭笍

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

Impacted Files Coverage 螖
...ages/eslint-plugin/src/rules/no-unsafe-argument.ts 85.22% <81.25%> (+4.06%) 猬嗭笍

@bradzacher bradzacher merged commit 6f8cfe6 into master Apr 6, 2021
9 of 10 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2021
@bradzacher bradzacher deleted the no-unsafe-arg-fix-tuple-rest-args branch Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant