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

reference not add to dependencies if only its type is used as typeof arg #19316

Merged
merged 2 commits into from
Jul 13, 2020

Conversation

delca85
Copy link
Contributor

@delca85 delca85 commented Jul 10, 2020

Summary

Fixes #18828 .

react-exhaustive-deps does not complain anymore about a missing dependency if its value is never used but its type is used as typeof argument.

Checking if a reference parent type has type TSTypeQuery, a reference is not added to dependencies.

Test Plan

Added test to check the expected behavior and even that the dependency is required by react-exhaustive-deps if its type is used and its value too.

@sizebot
Copy link

sizebot commented Jul 10, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against e85dcbe

@sizebot
Copy link

sizebot commented Jul 10, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against e85dcbe

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 10, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e85dcbe:

Sandbox Source
React Configuration
upbeat-chatelet-t3x7d Issue #18828

@rickhanlonii
Copy link
Member

@delca85 thanks for this!

Will this also fix #19327? Could we add a test for that as well?

@delca85
Copy link
Contributor Author

delca85 commented Jul 13, 2020

Hey @rickhanlonii, actually it should fix it too but I am going to check it as soon as possible!

@gaearon gaearon force-pushed the remove-typeof-guard-as-hooks-deps branch from bbad4b7 to e85dcbe Compare July 13, 2020 16:46
@gaearon
Copy link
Collaborator

gaearon commented Jul 13, 2020

I'll rebase and get this in. Confirmed it fixes #19327.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug [ESLint Hooks Plugin]: When using a typeof type guard it requires the value as a dependency
5 participants